class ClientsController < ApplicationController include ClientHelper include UsersHelper def index # we want to enforce that /client is always the client view prefix # this is a side effect of setting root path to '/'; soon we can remove this when we implement the new home page if request.path == '/' redirect_to client_url return end # use gon to pass variables into javascript gon.websocket_gateway_uri = Rails.application.config.websocket_gateway_uri gon.check_for_client_updates = Rails.application.config.check_for_client_updates gon.fp_apikey = Rails.application.config.filepicker_rails.api_key gon.fp_upload_dir = Rails.application.config.filepicker_upload_dir gon.allow_force_native_client = Rails.application.config.allow_force_native_client # is this the native client or browser? @nativeClient = is_native_client? # let javascript have access to the server's opinion if this is a native client gon.isNativeClient = @nativeClient if current_user render :layout => 'client' else redirect_to root_url end end AUTHED = %W{friend} def auth_action if current_user session.delete(:return_to) if session[:return_to] =~ /authed/ # FIXME: implement auth-action on a per-case basis redirect_to(client_url) and return else if AUTHED.include?(params[:authed]) session[:return_to] = auth_action_url(:authed => params[:authed], :data => params[:data]) else session.delete(:return_to) if session[:return_to] =~ /authed/ end redirect_to client_url end end end