mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
Merge branch 'master' of github.com:domify/registry
This commit is contained in:
commit
e27132bab7
15 changed files with 99 additions and 67 deletions
|
@ -1,14 +1,27 @@
|
|||
class Admin::SessionsController < SessionsController
|
||||
class Admin::SessionsController < Devise::SessionsController
|
||||
skip_authorization_check only: :create
|
||||
layout 'admin/application'
|
||||
|
||||
def create
|
||||
super
|
||||
end
|
||||
|
||||
def login
|
||||
@admin_user = AdminUser.new
|
||||
end
|
||||
|
||||
def find_user_by_idc(idc)
|
||||
AdminUser.find_by(identity_code: idc)
|
||||
def create
|
||||
if params[:admin_user].blank?
|
||||
@admin_user = AdminUser.new
|
||||
flash[:alert] = 'Something went wrong'
|
||||
return render 'login'
|
||||
end
|
||||
|
||||
@admin_user = AdminUser.find_by(username: params[:admin_user][:username])
|
||||
@admin_user ||= AdminUser.new(username: params[:admin_user][:username])
|
||||
|
||||
if @admin_user.valid_password?(params[:admin_user][:password])
|
||||
sign_in @admin_user, event: :authentication
|
||||
redirect_to admin_root_url, notice: I18n.t(:welcome)
|
||||
else
|
||||
flash[:alert] = 'Authorization error'
|
||||
render 'login'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Registrant::SessionsController < ::SessionsController
|
||||
class Registrant::SessionsController < Devise::SessionsController
|
||||
layout 'registrant/application'
|
||||
helper_method :depp_controller?
|
||||
def depp_controller?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Registrar::SessionsController < ::SessionsController
|
||||
class Registrar::SessionsController < Devise::SessionsController
|
||||
layout 'registrar/application'
|
||||
helper_method :depp_controller?
|
||||
def depp_controller?
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
class SessionsController < Devise::SessionsController
|
||||
skip_authorization_check only: :create
|
||||
|
||||
def create
|
||||
# TODO: Create ID Card login here:
|
||||
# this is just testing config
|
||||
# if Rails.env.development? || Rails.env.test?
|
||||
@user = AdminUser.first if params[:user1]
|
||||
@user = AdminUser.second if params[:user2]
|
||||
|
||||
return redirect_to :back, alert: 'No user' if @user.blank?
|
||||
|
||||
flash[:notice] = I18n.t('welcome')
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
# end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue