diff --git a/web/app/controllers/clients_controller.rb b/web/app/controllers/clients_controller.rb index 03b83ac88..009256e40 100644 --- a/web/app/controllers/clients_controller.rb +++ b/web/app/controllers/clients_controller.rb @@ -33,9 +33,26 @@ class ClientsController < ApplicationController gon.isNativeClient = @nativeClient if current_user - render :layout => 'client' + render :layout => 'client' else - redirect_to "/signin" + redirect_to "/signin" + 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 diff --git a/web/config/routes.rb b/web/config/routes.rb index 516eec151..53b8ed58d 100644 --- a/web/config/routes.rb +++ b/web/config/routes.rb @@ -44,6 +44,8 @@ SampleApp::Application.routes.draw do match '/test_connection', to: 'sessions#connection_state', :as => :connection_state + match '/client/authed/:authed/:data', to: 'clients#auth_action', :as => :auth_action + # ping test match '/ping', to: 'ping#index' match '/ping/pingat.jnlp', to: 'ping#at' @@ -65,7 +67,6 @@ SampleApp::Application.routes.draw do # email update match '/confirm_email' => 'users#finalize_update_email', :as => 'confirm_email' # NOTE: if you change this, you break outstanding email changes because links in user inboxes are broken - scope '/corp' do match '/about', to: 'corps#about', as: 'corp_about' match '/contact', to: 'corps#contact', as: 'corp_contact'