vrfs-868: added auth_action route to enable GET-based actions requiring authentication
This commit is contained in:
parent
1d0b07cbe1
commit
c3d49de7f1
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in New Issue