module JT::User::Authentication

Public Instance Methods

authenticate(email, password) click to toggle source
# File lib/generators/jt/user/templates/models/concerns/jt/user/authentication.rb, line 21
def authenticate(email, password)
        self.search_by_email_for_authentication(email).first.try(:authenticate, password)
end
downcase_email() click to toggle source
# File lib/generators/jt/user/templates/models/concerns/jt/user/authentication.rb, line 27
def downcase_email
        self.email = self.email.downcase.strip.presence if self.email
end
increment_login_stats!(remote_ip) click to toggle source
# File lib/generators/jt/user/templates/models/concerns/jt/user/authentication.rb, line 31
def increment_login_stats!(remote_ip)
        attributes = {
                last_login_at: Time.now,
                last_login_remote_ip: remote_ip,
                login_count: (self.login_count || 0) + 1
        }

        self.update_columns(attributes)
end