Module: Clearance::User::ClassMethods

Defined in:
lib/clearance/user.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(email, password) ⇒ User?

Authenticate with email and password.

Examples:

User.authenticate("[email protected]", "password")

Parameters:

  • email (String, String)

    and password

Returns:

  • (User, nil)

    authenticated user or nil



192
193
194
195
# File 'lib/clearance/user.rb', line 192

def authenticate(email, password)
  return nil  unless user = find_by_email(email)
  return user if     user.authenticated?(password)
end