Module: Authlogic::ActsAsAuthentic::Login::Config
- Defined in:
- lib/authlogic/acts_as_authentic/login.rb
Overview
Confguration for the login field.
Instance Method Summary collapse
-
#login_field(value = nil) ⇒ Object
(also: #login_field=)
The name of the login field in the database.
-
#validate_login_field(value = nil) ⇒ Object
(also: #validate_login_field=)
Whether or not the validate the login field.
-
#validates_format_of_login_field_options(value = nil) ⇒ Object
(also: #validates_format_of_login_field_options=)
A hash of options for the validates_format_of call for the email field.
-
#validates_length_of_login_field_options(value = nil) ⇒ Object
(also: #validates_length_of_login_field_options=)
A hash of options for the validates_length_of call for the login field.
Instance Method Details
#login_field(value = nil) ⇒ Object Also known as: login_field=
The name of the login field in the database.
-
Default:
:login or :username, if they exist -
Accepts:
Symbol
18 19 20 |
# File 'lib/authlogic/acts_as_authentic/login.rb', line 18 def login_field(value = nil) config(:login_field, value, first_column_to_exist(nil, :login, :username)) end |
#validate_login_field(value = nil) ⇒ Object Also known as: validate_login_field=
Whether or not the validate the login field
-
Default:
true -
Accepts:
Boolean
27 28 29 |
# File 'lib/authlogic/acts_as_authentic/login.rb', line 27 def validate_login_field(value = nil) config(:validate_login_field, value, true) end |
#validates_format_of_login_field_options(value = nil) ⇒ Object Also known as: validates_format_of_login_field_options=
A hash of options for the validates_format_of call for the email field. Allows you to change this however you want.
-
Default:
=> /Aw[w.-_@ ]+z/, :message => I18n.t(‘error_messages.login_invalid’, :default => “should use only letters, numbers, spaces, and .-_@ please.”) -
Accepts:
Hash of options accepted by validates_format_of
45 46 47 |
# File 'lib/authlogic/acts_as_authentic/login.rb', line 45 def (value = nil) config(:validates_format_of_login_field_options, value, {:with => /\A\w[\w\.\-_@ ]+\z/, :message => I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}) end |
#validates_length_of_login_field_options(value = nil) ⇒ Object Also known as: validates_length_of_login_field_options=
A hash of options for the validates_length_of call for the login field. Allows you to change this however you want.
-
Default:
=> 6..100 -
Accepts:
Hash of options accepted by validates_length_of
36 37 38 |
# File 'lib/authlogic/acts_as_authentic/login.rb', line 36 def (value = nil) config(:validates_length_of_login_field_options, value, {:within => 3..100}) end |