Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Track successful and not successful login & disabled users #214

Open
christiangewalt opened this issue May 10, 2018 · 1 comment
Open

Track successful and not successful login & disabled users #214

christiangewalt opened this issue May 10, 2018 · 1 comment

Comments

@christiangewalt
Copy link

I would like to write some informations to the database like:

  • last successful login date
  • last unsuccessful login attempt
  • number of unsuccessful login attempt

What is the best way to achieve this?

And second I would like to mark users as disabled in the database and throw an exception on login.

@rubiii
Copy link

rubiii commented Aug 5, 2018

You could overwrite the User#authenticate method (which is what I’m currently doing):

class User
  def authenticate(password)
    return false if locked?
    user = super(password)
    failed_auth_attempt! unless user
    user
  end
end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants