Context switching for client

This commit is contained in:
Martin Lensment 2014-09-26 17:32:57 +03:00
parent 5dfee40b87
commit b48b91878d
9 changed files with 44 additions and 12 deletions

View file

@ -6,6 +6,8 @@ class SessionsController < Devise::SessionsController
@user = User.find_by(username: 'gitlab') if params[:gitlab]
@user = User.find_by(username: 'zone') if params[:zone]
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
flash[:notice] = I18n.t('shared.welcome')
sign_in_and_redirect @user, :event => :authentication
return
@ -15,4 +17,10 @@ class SessionsController < Devise::SessionsController
def login
render 'layouts/login', layout: false
end
def switch_registrar
authorize! :switch, :registrar
session[:current_user_registrar_id] = params[:registrar_id]
redirect_to client_root_path
end
end