Class: MinimalistAuthentication::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/minimalist_authentication/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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.      = :root_path
  self.logout_redirect_path     = :new_session_path
end

Instance Attribute Details

#login_redirect_pathObject

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
end

#logout_redirect_pathObject

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_emailObject

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_keyObject

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_nameObject

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_emailObject

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_presenceObject

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_emailObject

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_modelObject

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