Module: Authenticate::Model::Username

Extended by:
ActiveSupport::Concern
Defined in:
lib/authenticate/model/username.rb

Overview

Use :username as the identifier for the user. Username must be unique.

Columns

  • username - the username of your user

Validations

  • :username requires username is set, ensure it is unique

class methods

  • credentials(params) - return the credentials required for authorization by username

  • authenticate(credentials) - find user with given username, validate their password, return user if authenticated

  • find_by_credentials(credentials) - find and return the user with the username in the credentials

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.required_fields(_klass) ⇒ Object



20
21
22
# File 'lib/authenticate/model/username.rb', line 20

def self.required_fields(_klass)
  [:username, :email]
end