mardi 21 juillet 2015

How can I update table when a user is locked after maximum login attempts?

In my rails application, I managed to lock users after a maximum failed login treshold using Devise lockable, but how can I update the table so that I can add an entry to user denoting this user is locked also with timestamp !

I just don't know where to put that code in !

I tried to create a file called "lockable.rb" in Initializer with following code,

    def lock_access!(opts = { })
      @user.is_lock = "Yes"
      @user.reason_of_deactivation = "Failed login attempt"
      @user.deactivated_date = DateTime.now
      @user.save
    end

That didn't worked out !

Aucun commentaire:

Enregistrer un commentaire