Module: Authenticate::Model::Email
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/authenticate/model/email.rb
Overview
Use :email as the identifier for the user. Email must be unique.
Columns
-
email - the email address of the user
Validations
-
:email - require email is set, is a valid format, and is unique
Callbacks
Methods
-
normalize_email - normalize the email, removing spaces etc, before saving
Class Methods
-
credentials(params) - return the credentials required for authorization by email
-
authenticate(credentials) - find user with given email, validate their password, return user if authenticated
-
normalize_email(email) - clean up the given email and return it.
-
find_by_credentials(credentials) - find and return the user with the email address in the credentials
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#normalize_email ⇒ String
Sets the email on this instance to the value returned by class method #normalize_email.
Class Method Details
.required_fields(_klass) ⇒ Object
28 29 30 |
# File 'lib/authenticate/model/email.rb', line 28 def self.required_fields(_klass) [:email] end |
Instance Method Details
#normalize_email ⇒ String
Sets the email on this instance to the value returned by class method #normalize_email
64 65 66 |
# File 'lib/authenticate/model/email.rb', line 64 def normalize_email self.email = self.class.normalize_email(email) end |