Class: MinimalistAuthentication::Configuration
- Inherits:
-
Object
- Object
- MinimalistAuthentication::Configuration
- Defined in:
- lib/minimalist_authentication/configuration.rb
Instance Attribute Summary collapse
-
#login_redirect_path ⇒ Object
Where to route users after a successful login.
-
#logout_redirect_path ⇒ Object
Where to route users after logging out.
-
#request_email ⇒ Object
Check for users email at login and request if blank.
-
#session_key ⇒ Object
The session_key used to store the current_user id.
-
#user_model_name ⇒ Object
The application user class name Defaults to ‘::User’.
-
#validate_email ⇒ Object
Toggle all email validations.
-
#validate_email_presence ⇒ Object
Toggle email presence validation.
-
#verify_email ⇒ Object
Verify users email address at login.
Instance Method Summary collapse
- #email_prefix=(_) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#user_model ⇒ Object
Returns the user_model class Calling constantize on a string makes this work correctly with the Spring application preloader gem.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/minimalist_authentication/configuration.rb', line 54 def initialize self.user_model_name = "::User" self.session_key = :user_id self.validate_email = true self.validate_email_presence = true self.request_email = true self.verify_email = true self.login_redirect_path = :root_path self.logout_redirect_path = :new_session_path end |
Instance Attribute Details
#login_redirect_path ⇒ Object
Where to route users after a successful login. Defaults to :root_path
48 49 50 |
# File 'lib/minimalist_authentication/configuration.rb', line 48 def login_redirect_path @login_redirect_path end |
#logout_redirect_path ⇒ Object
Where to route users after logging out. Defaults to :new_session_path
52 53 54 |
# File 'lib/minimalist_authentication/configuration.rb', line 52 def logout_redirect_path @logout_redirect_path end |
#request_email ⇒ Object
Check for users email at login and request if blank. Only useful if using username to login and users might not have an email set. Defaults to true
40 41 42 |
# File 'lib/minimalist_authentication/configuration.rb', line 40 def request_email @request_email end |
#session_key ⇒ Object
The session_key used to store the current_user id. Defaults to :user_id
22 23 24 |
# File 'lib/minimalist_authentication/configuration.rb', line 22 def session_key @session_key end |
#user_model_name ⇒ Object
The application user class name Defaults to ‘::User’
26 27 28 |
# File 'lib/minimalist_authentication/configuration.rb', line 26 def user_model_name @user_model_name end |
#validate_email ⇒ Object
Toggle all email validations. Defaults to true.
30 31 32 |
# File 'lib/minimalist_authentication/configuration.rb', line 30 def validate_email @validate_email end |
#validate_email_presence ⇒ Object
Toggle email presence validation. Defaults to true. Note: validate_email_presence is only checked if validate_email is true.
35 36 37 |
# File 'lib/minimalist_authentication/configuration.rb', line 35 def validate_email_presence @validate_email_presence end |
#verify_email ⇒ Object
Verify users email address at login. Defaults to true.
44 45 46 |
# File 'lib/minimalist_authentication/configuration.rb', line 44 def verify_email @verify_email end |
Instance Method Details
#email_prefix=(_) ⇒ Object
65 66 67 |
# File 'lib/minimalist_authentication/configuration.rb', line 65 def email_prefix=(_) MinimalistAuthentication.deprecator.warn("The #email_prefix configuration setting is no longer supported.") end |
#user_model ⇒ Object
Returns the user_model class Calling constantize on a string makes this work correctly with the Spring application preloader gem.
72 73 74 |
# File 'lib/minimalist_authentication/configuration.rb', line 72 def user_model user_model_name.constantize end |