Class: Searls::Auth::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/searls/auth/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#after_login_successObject

Returns the value of attribute after_login_success

Returns:

  • (Object)

    the current value of after_login_success



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @after_login_success
end

#app_nameObject

Returns the value of attribute app_name

Returns:

  • (Object)

    the current value of app_name



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def app_name
  @app_name
end

#app_urlObject

Returns the value of attribute app_url

Returns:

  • (Object)

    the current value of app_url



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def app_url
  @app_url
end

#auth_methodsObject

Returns the value of attribute auth_methods

Returns:

  • (Object)

    the current value of auth_methods



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def auth_methods
  @auth_methods
end

#auto_login_after_password_resetObject

Returns the value of attribute auto_login_after_password_reset

Returns:

  • (Object)

    the current value of auto_login_after_password_reset



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @auto_login_after_password_reset
end

#before_password_resetObject

Returns the value of attribute before_password_reset

Returns:

  • (Object)

    the current value of before_password_reset



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def before_password_reset
  @before_password_reset
end

#email_background_colorObject

Returns the value of attribute email_background_color

Returns:

  • (Object)

    the current value of email_background_color



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_background_color
  @email_background_color
end

#email_banner_image_pathObject

Returns the value of attribute email_banner_image_path

Returns:

  • (Object)

    the current value of email_banner_image_path



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_banner_image_path
  @email_banner_image_path
end

#email_button_colorObject

Returns the value of attribute email_button_color

Returns:

  • (Object)

    the current value of email_button_color



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_button_color
  @email_button_color
end

#email_otp_expiry_minutesObject

Returns the value of attribute email_otp_expiry_minutes

Returns:

  • (Object)

    the current value of email_otp_expiry_minutes



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_otp_expiry_minutes
  @email_otp_expiry_minutes
end

#email_verification_modeObject

Returns the value of attribute email_verification_mode

Returns:

  • (Object)

    the current value of email_verification_mode



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_verification_mode
  @email_verification_mode
end

#email_verified_predicateObject

Returns the value of attribute email_verified_predicate

Returns:

  • (Object)

    the current value of email_verified_predicate



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_verified_predicate
  @email_verified_predicate
end

#email_verified_setterObject

Returns the value of attribute email_verified_setter

Returns:

  • (Object)

    the current value of email_verified_setter



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def email_verified_setter
  @email_verified_setter
end

#flash_error_after_login_attempt_invalid_passwordObject

Returns the value of attribute flash_error_after_login_attempt_invalid_password

Returns:

  • (Object)

    the current value of flash_error_after_login_attempt_invalid_password



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @flash_error_after_login_attempt_invalid_password
end

#flash_error_after_login_attempt_unknown_emailObject

Returns the value of attribute flash_error_after_login_attempt_unknown_email

Returns:

  • (Object)

    the current value of flash_error_after_login_attempt_unknown_email



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @flash_error_after_login_attempt_unknown_email
end

#flash_error_after_login_attempt_unverified_emailObject

Returns the value of attribute flash_error_after_login_attempt_unverified_email

Returns:

  • (Object)

    the current value of flash_error_after_login_attempt_unverified_email



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @flash_error_after_login_attempt_unverified_email
end

#flash_error_after_password_misconfiguredObject

Returns the value of attribute flash_error_after_password_misconfigured

Returns:

  • (Object)

    the current value of flash_error_after_password_misconfigured



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_password_misconfigured
  @flash_error_after_password_misconfigured
end

#flash_error_after_password_reset_not_enabledObject

Returns the value of attribute flash_error_after_password_reset_not_enabled

Returns:

  • (Object)

    the current value of flash_error_after_password_reset_not_enabled



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_password_reset_not_enabled
  @flash_error_after_password_reset_not_enabled
end

#flash_error_after_password_reset_password_blankObject

Returns the value of attribute flash_error_after_password_reset_password_blank

Returns:

  • (Object)

    the current value of flash_error_after_password_reset_password_blank



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_password_reset_password_blank
  @flash_error_after_password_reset_password_blank
end

#flash_error_after_password_reset_password_mismatchObject

Returns the value of attribute flash_error_after_password_reset_password_mismatch

Returns:

  • (Object)

    the current value of flash_error_after_password_reset_password_mismatch



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_password_reset_password_mismatch
  @flash_error_after_password_reset_password_mismatch
end

#flash_error_after_password_reset_token_invalidObject

Returns the value of attribute flash_error_after_password_reset_token_invalid

Returns:

  • (Object)

    the current value of flash_error_after_password_reset_token_invalid



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_password_reset_token_invalid
  @flash_error_after_password_reset_token_invalid
end

#flash_error_after_register_attemptObject

Returns the value of attribute flash_error_after_register_attempt

Returns:

  • (Object)

    the current value of flash_error_after_register_attempt



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_register_attempt
  @flash_error_after_register_attempt
end

#flash_error_after_settings_current_password_invalidObject

Returns the value of attribute flash_error_after_settings_current_password_invalid

Returns:

  • (Object)

    the current value of flash_error_after_settings_current_password_invalid



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_settings_current_password_invalid
  @flash_error_after_settings_current_password_invalid
end

#flash_error_after_settings_current_password_missingObject

Returns the value of attribute flash_error_after_settings_current_password_missing

Returns:

  • (Object)

    the current value of flash_error_after_settings_current_password_missing



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_settings_current_password_missing
  @flash_error_after_settings_current_password_missing
end

#flash_error_after_verify_attempt_exceeds_limitObject

Returns the value of attribute flash_error_after_verify_attempt_exceeds_limit

Returns:

  • (Object)

    the current value of flash_error_after_verify_attempt_exceeds_limit



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_verify_attempt_exceeds_limit
  @flash_error_after_verify_attempt_exceeds_limit
end

#flash_error_after_verify_attempt_incorrect_email_otpObject

Returns the value of attribute flash_error_after_verify_attempt_incorrect_email_otp

Returns:

  • (Object)

    the current value of flash_error_after_verify_attempt_incorrect_email_otp



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_verify_attempt_incorrect_email_otp
  @flash_error_after_verify_attempt_incorrect_email_otp
end

Returns the value of attribute flash_error_after_verify_attempt_invalid_link

Returns:

  • (Object)

    the current value of flash_error_after_verify_attempt_invalid_link



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_error_after_verify_attempt_invalid_link
  @flash_error_after_verify_attempt_invalid_link
end

#flash_notice_after_email_verifiedObject

Returns the value of attribute flash_notice_after_email_verified

Returns:

  • (Object)

    the current value of flash_notice_after_email_verified



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_email_verified
  @flash_notice_after_email_verified
end

#flash_notice_after_loginObject

Returns the value of attribute flash_notice_after_login

Returns:

  • (Object)

    the current value of flash_notice_after_login



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @flash_notice_after_login
end

#flash_notice_after_login_attemptObject

Returns the value of attribute flash_notice_after_login_attempt

Returns:

  • (Object)

    the current value of flash_notice_after_login_attempt



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @flash_notice_after_login_attempt
end

#flash_notice_after_login_with_unverified_emailObject

Returns the value of attribute flash_notice_after_login_with_unverified_email

Returns:

  • (Object)

    the current value of flash_notice_after_login_with_unverified_email



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @flash_notice_after_login_with_unverified_email
end

#flash_notice_after_logoutObject

Returns the value of attribute flash_notice_after_logout

Returns:

  • (Object)

    the current value of flash_notice_after_logout



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_logout
  @flash_notice_after_logout
end

#flash_notice_after_password_resetObject

Returns the value of attribute flash_notice_after_password_reset

Returns:

  • (Object)

    the current value of flash_notice_after_password_reset



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_password_reset
  @flash_notice_after_password_reset
end

#flash_notice_after_password_reset_emailObject

Returns the value of attribute flash_notice_after_password_reset_email

Returns:

  • (Object)

    the current value of flash_notice_after_password_reset_email



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_password_reset_email
  @flash_notice_after_password_reset_email
end

#flash_notice_after_registrationObject

Returns the value of attribute flash_notice_after_registration

Returns:

  • (Object)

    the current value of flash_notice_after_registration



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_registration
  @flash_notice_after_registration
end

#flash_notice_after_settings_updateObject

Returns the value of attribute flash_notice_after_settings_update

Returns:

  • (Object)

    the current value of flash_notice_after_settings_update



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_settings_update
  @flash_notice_after_settings_update
end

#flash_notice_after_verification_email_resentObject

Returns the value of attribute flash_notice_after_verification_email_resent

Returns:

  • (Object)

    the current value of flash_notice_after_verification_email_resent



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def flash_notice_after_verification_email_resent
  @flash_notice_after_verification_email_resent
end

#layoutObject

Returns the value of attribute layout

Returns:

  • (Object)

    the current value of layout



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def layout
  @layout
end

#login_viewObject

Returns the value of attribute login_view

Returns:

  • (Object)

    the current value of login_view



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @login_view
end

#mail_email_verification_template_nameObject

Returns the value of attribute mail_email_verification_template_name

Returns:

  • (Object)

    the current value of mail_email_verification_template_name



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def mail_email_verification_template_name
  @mail_email_verification_template_name
end

#mail_email_verification_template_pathObject

Returns the value of attribute mail_email_verification_template_path

Returns:

  • (Object)

    the current value of mail_email_verification_template_path



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def mail_email_verification_template_path
  @mail_email_verification_template_path
end

#mail_layoutObject

Returns the value of attribute mail_layout

Returns:

  • (Object)

    the current value of mail_layout



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def mail_layout
  @mail_layout
end

#mail_login_template_nameObject

Returns the value of attribute mail_login_template_name

Returns:

  • (Object)

    the current value of mail_login_template_name



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @mail_login_template_name
end

#mail_login_template_pathObject

Returns the value of attribute mail_login_template_path

Returns:

  • (Object)

    the current value of mail_login_template_path



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @mail_login_template_path
end

#mail_password_reset_template_nameObject

Returns the value of attribute mail_password_reset_template_name

Returns:

  • (Object)

    the current value of mail_password_reset_template_name



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def mail_password_reset_template_name
  @mail_password_reset_template_name
end

#mail_password_reset_template_pathObject

Returns the value of attribute mail_password_reset_template_path

Returns:

  • (Object)

    the current value of mail_password_reset_template_path



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def mail_password_reset_template_path
  @mail_password_reset_template_path
end

#max_allowed_email_otp_attemptsObject

Returns the value of attribute max_allowed_email_otp_attempts

Returns:

  • (Object)

    the current value of max_allowed_email_otp_attempts



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def max_allowed_email_otp_attempts
  @max_allowed_email_otp_attempts
end

#password_present_predicateObject

Returns the value of attribute password_present_predicate

Returns:

  • (Object)

    the current value of password_present_predicate



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_present_predicate
  @password_present_predicate
end

#password_reset_edit_viewObject

Returns the value of attribute password_reset_edit_view

Returns:

  • (Object)

    the current value of password_reset_edit_view



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_reset_edit_view
  @password_reset_edit_view
end

#password_reset_enabledObject

Returns the value of attribute password_reset_enabled

Returns:

  • (Object)

    the current value of password_reset_enabled



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_reset_enabled
  @password_reset_enabled
end

#password_reset_request_viewObject

Returns the value of attribute password_reset_request_view

Returns:

  • (Object)

    the current value of password_reset_request_view



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_reset_request_view
  @password_reset_request_view
end

#password_reset_token_finderObject

Returns the value of attribute password_reset_token_finder

Returns:

  • (Object)

    the current value of password_reset_token_finder



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_reset_token_finder
  @password_reset_token_finder
end

#password_reset_token_generatorObject

Returns the value of attribute password_reset_token_generator

Returns:

  • (Object)

    the current value of password_reset_token_generator



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_reset_token_generator
  @password_reset_token_generator
end

#password_setterObject

Returns the value of attribute password_setter

Returns:

  • (Object)

    the current value of password_setter



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_setter
  @password_setter
end

#password_verifierObject

Returns the value of attribute password_verifier

Returns:

  • (Object)

    the current value of password_verifier



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def password_verifier
  @password_verifier
end

#pending_email_verification_viewObject

Returns the value of attribute pending_email_verification_view

Returns:

  • (Object)

    the current value of pending_email_verification_view



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def pending_email_verification_view
  @pending_email_verification_view
end

#preserve_session_keys_after_logoutObject

Returns the value of attribute preserve_session_keys_after_logout

Returns:

  • (Object)

    the current value of preserve_session_keys_after_logout



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def preserve_session_keys_after_logout
  @preserve_session_keys_after_logout
end

#redirect_path_after_loginObject

Returns the value of attribute redirect_path_after_login

Returns:

  • (Object)

    the current value of redirect_path_after_login



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def 
  @redirect_path_after_login
end

#redirect_path_after_registerObject

Returns the value of attribute redirect_path_after_register

Returns:

  • (Object)

    the current value of redirect_path_after_register



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def redirect_path_after_register
  @redirect_path_after_register
end

#redirect_path_after_settings_changeObject

Returns the value of attribute redirect_path_after_settings_change

Returns:

  • (Object)

    the current value of redirect_path_after_settings_change



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def redirect_path_after_settings_change
  @redirect_path_after_settings_change
end

#register_viewObject

Returns the value of attribute register_view

Returns:

  • (Object)

    the current value of register_view



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def register_view
  @register_view
end

#token_generatorObject

Returns the value of attribute token_generator

Returns:

  • (Object)

    the current value of token_generator



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def token_generator
  @token_generator
end

#user_finder_by_emailObject

Returns the value of attribute user_finder_by_email

Returns:

  • (Object)

    the current value of user_finder_by_email



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def user_finder_by_email
  @user_finder_by_email
end

#user_finder_by_idObject

Returns the value of attribute user_finder_by_id

Returns:

  • (Object)

    the current value of user_finder_by_id



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def user_finder_by_id
  @user_finder_by_id
end

#user_finder_by_tokenObject

Returns the value of attribute user_finder_by_token

Returns:

  • (Object)

    the current value of user_finder_by_token



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def user_finder_by_token
  @user_finder_by_token
end

#user_initializerObject

Returns the value of attribute user_initializer

Returns:

  • (Object)

    the current value of user_initializer



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def user_initializer
  @user_initializer
end

#user_name_methodObject

Returns the value of attribute user_name_method

Returns:

  • (Object)

    the current value of user_name_method



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def user_name_method
  @user_name_method
end

#validate_registrationObject

Returns the value of attribute validate_registration

Returns:

  • (Object)

    the current value of validate_registration



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def validate_registration
  @validate_registration
end

#verify_viewObject

Returns the value of attribute verify_view

Returns:

  • (Object)

    the current value of verify_view



21
22
23
# File 'lib/searls/auth/config.rb', line 21

def verify_view
  @verify_view
end

Instance Method Details

#password_present?(user) ⇒ Boolean

Returns:

  • (Boolean)


111
112
113
114
115
116
# File 'lib/searls/auth/config.rb', line 111

def password_present?(user)
  predicate = password_present_predicate
  return false if predicate.nil?

  predicate.call(user)
end

#password_reset_enabled?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/searls/auth/config.rb', line 107

def password_reset_enabled?
  auth_methods.include?(:password) && password_reset_enabled
end

#resolve(option, *args) ⇒ Object

Get values from values that might be procs



101
102
103
104
105
# File 'lib/searls/auth/config.rb', line 101

def resolve(option, *args)
  key = option.to_sym
  value = public_send(key)
  value.respond_to?(:call) ? value.call(*args) : value
end

#validate!Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/searls/auth/config.rb', line 118

def validate!
  validate_auth_methods!
  validate_email_verification_mode!
  validate_numeric_options!
  validate_core_hooks!
  validate_password_settings!
  validate_default_user_hooks!
rescue => e
  unless [
    "PG::UndefinedTable",
    "ActiveRecord::NoDatabaseError",
    "ActiveRecord::StatementInvalid"
  ].include?(e.class.inspect)
    # don't validate when connection isn't esstablished
    raise
  end
end