mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
26 lines
751 B
Ruby
26 lines
751 B
Ruby
class SessionsController < Devise::SessionsController
|
|
def create
|
|
#TODO: Create ID Card login here:
|
|
# this is just testing config
|
|
# if Rails.env.development? || Rails.env.test?
|
|
@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
|
|
# end
|
|
end
|
|
|
|
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
|