module Authenticate::Model::Email
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
Public Class Methods
required_fields(_klass)
click to toggle source
# File lib/authenticate/model/email.rb, line 28 def self.required_fields(_klass) [:email] end
Public Instance Methods
normalize_email()
click to toggle source
Sets the email on this instance to the value returned by class method normalize_email
@return [String]
# File lib/authenticate/model/email.rb, line 64 def normalize_email self.email = self.class.normalize_email(email) end