Class: Admin::SessionsController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- PagesCore::BaseController
- ApplicationController
- PagesCore::AdminController
- AdminController
- Admin::SessionsController
- Defined in:
- app/controllers/admin/sessions_controller.rb
Instance Attribute Summary
Attributes included from PagesCore::Authentication
Instance Method Summary collapse
Methods inherited from PagesCore::AdminController
Methods included from PagesCore::StaticCacheController
#disable_static_cache!, #static_cached?
Methods included from PagesCore::PoliciesHelper
#policy, #verify_policy, #verify_policy_with_proc
Methods included from PagesCore::ProcessTitler
inc_number_of_requests, original_title
Methods included from PagesCore::LocalesHelper
Methods included from PagesCore::ErrorRenderer
Methods included from PagesCore::Authentication
#authenticate!, #deauthenticate!, #logged_in?
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/admin/sessions_controller.rb', line 14 def create if @user.otp_enabled? @signed_user_id = .generate( @user.id, expires_in: 1.hour ) render template: "admin/sessions/verify_otp" else authenticate!(@user) redirect_to admin_default_url end end |
#destroy ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/admin/sessions_controller.rb', line 26 def destroy flash[:notice] = t("pages_core.logged_out") deauthenticate! redirect_to admin_login_url end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/admin/sessions_controller.rb', line 10 def new redirect_to admin_default_url if logged_in? end |
#verify_otp ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/sessions_controller.rb', line 32 def verify_otp @otp_secret = OtpSecret.new(@user) if @otp_secret.validate_otp!(params[:otp]) authenticate!(@user) redirect_to admin_default_url else flash[:notice] = t("pages_core.otp.invalid_code") render template: "admin/sessions/verify_otp" end end |