class Clearance::DefaultSignInGuard
Runs as the base {SignInGuard} for all requests, regardless of configured {Configuration#sign_in_guards}.
Public Instance Methods
call()
click to toggle source
Runs the default sign in guard.
If there is a value set in the clearance session object, then the guard returns {SuccessStatus}. Otherwise, it returns {FailureStatus} with the message returned by {#default_failure_message}.
@return [SuccessStatus, FailureStatus]
# File lib/clearance/default_sign_in_guard.rb, line 12 def call if session.signed_in? success else failure default_failure_message.html_safe end end
default_failure_message()
click to toggle source
The default failure message pulled from the i18n framework.
Will use the value returned from the following i18n keys, in this order:
-
‘clearance.controllers.sessions.bad_email_or_password`
-
‘flashes.failure_after_create`
@return [String]
# File lib/clearance/default_sign_in_guard.rb, line 28 def default_failure_message I18n.t( :bad_email_or_password, scope: [:clearance, :controllers, :sessions], default: I18n.t('flashes.failure_after_create').html_safe ) end