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



199
200
201
202
# File 'lib/clearance/user.rb', line 199

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