Module: Sinatra::SimpleAuthentication::Controllers::Defaults
- Defined in:
- lib/sinatra/simple_authentication/controllers/defaults.rb
Class Attribute Summary collapse
-
.invalid_email_message ⇒ Object
Returns the value of attribute invalid_email_message.
-
.login_successful_message ⇒ Object
Returns the value of attribute login_successful_message.
-
.login_wrong_email_message ⇒ Object
Returns the value of attribute login_wrong_email_message.
-
.login_wrong_password_message ⇒ Object
Returns the value of attribute login_wrong_password_message.
-
.long_password_message ⇒ Object
Returns the value of attribute long_password_message.
-
.max_password_length ⇒ Object
Returns the value of attribute max_password_length.
-
.min_password_length ⇒ Object
Returns the value of attribute min_password_length.
-
.missing_email_message ⇒ Object
Returns the value of attribute missing_email_message.
-
.missing_password_confirmation_message ⇒ Object
Returns the value of attribute missing_password_confirmation_message.
-
.missing_password_message ⇒ Object
Returns the value of attribute missing_password_message.
-
.password_confirmation_dont_match_password_message ⇒ Object
Returns the value of attribute password_confirmation_dont_match_password_message.
-
.short_password_message ⇒ Object
Returns the value of attribute short_password_message.
-
.taken_email_message ⇒ Object
Returns the value of attribute taken_email_message.
-
.use_password_confirmation ⇒ Object
Returns the value of attribute use_password_confirmation.
Class Method Summary collapse
Class Attribute Details
.invalid_email_message ⇒ Object
Returns the value of attribute invalid_email_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @invalid_email_message end |
.login_successful_message ⇒ Object
Returns the value of attribute login_successful_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @login_successful_message end |
.login_wrong_email_message ⇒ Object
Returns the value of attribute login_wrong_email_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @login_wrong_email_message end |
.login_wrong_password_message ⇒ Object
Returns the value of attribute login_wrong_password_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @login_wrong_password_message end |
.long_password_message ⇒ Object
Returns the value of attribute long_password_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @long_password_message end |
.max_password_length ⇒ Object
Returns the value of attribute max_password_length.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def max_password_length @max_password_length end |
.min_password_length ⇒ Object
Returns the value of attribute min_password_length.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def min_password_length @min_password_length end |
.missing_email_message ⇒ Object
Returns the value of attribute missing_email_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @missing_email_message end |
.missing_password_confirmation_message ⇒ Object
Returns the value of attribute missing_password_confirmation_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @missing_password_confirmation_message end |
.missing_password_message ⇒ Object
Returns the value of attribute missing_password_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @missing_password_message end |
.password_confirmation_dont_match_password_message ⇒ Object
Returns the value of attribute password_confirmation_dont_match_password_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @password_confirmation_dont_match_password_message end |
.short_password_message ⇒ Object
Returns the value of attribute short_password_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @short_password_message end |
.taken_email_message ⇒ Object
Returns the value of attribute taken_email_message.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def @taken_email_message end |
.use_password_confirmation ⇒ Object
Returns the value of attribute use_password_confirmation.
8 9 10 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 8 def use_password_confirmation @use_password_confirmation end |
Class Method Details
.configure {|_self| ... } ⇒ Object
24 25 26 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 24 def self.configure(&block) yield self end |
.setDefaults(app) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/sinatra/simple_authentication/controllers/defaults.rb', line 28 def self.setDefaults(app) app.set :sinatra_authentication_view_path, File.(File.join("../..", "views"), __FILE__) app.enable :sessions #Set costum variables app.set :use_password_confirmation, use_password_confirmation.nil? ? false : use_password_confirmation app.set :min_password_length, min_password_length.nil? ? 4 : min_password_length app.set :max_password_length, max_password_length.nil? ? 16 : max_password_length app.set :login_wrong_email_message, .nil? ? "Wrong email address." : app.set :login_wrong_password_message, .nil? ? "Wrong password." : app.set :login_successful_message, .nil? ? "Login successful." : #Validations errors messages taken_email = .nil? ? "Email has already been taken." : missing_email = .nil? ? "Email can't be blank." : invalid_email = .nil? ? "Invalid email format." : missing_password = .nil? ? "Password can't be blank." : short_password = .nil? ? "Password is too short, must be between #{app.settings.min_password_length} and #{app.settings.max_password_length} characters long." : long_password = .nil? ? "Password is too long, must be between #{app.settings.min_password_length} and #{app.settings.max_password_length} characters long." : missing_password_confirmation = .nil? ? "Password confirmation can't be blank." : password_confirmation_dont_match_password = .nil? ? "Password confirmation doesn't match password." : app.set :error_messages, { :missing_email => missing_email, :taken_email => taken_email, :invalid_email => invalid_email, :missing_password => missing_password, :short_password => short_password, :long_password => long_password, :missing_password_confirmation => missing_password_confirmation, :password_confirmation_dont_match_password => password_confirmation_dont_match_password } app end |