internetee-registry/app/controllers/sessions_controller.rb
2014-10-10 15:10:05 +03:00

26 lines
804 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]
@user = User.find_by(username: 'elkdata') if params[:elkdata]
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
flash[:notice] = I18n.t('shared.welcome')
sign_in_and_redirect @user, event: :authentication
# 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