Log incident when an account is locked after three failed attempts with Devise

社会主义新天地 提交于 2020-01-05 06:51:12

问题


I want to log in the database the incident when a users account is locked, I'm using Rails3 and Devise, so I think I'll need to override some action in a Devise controller, I just don't know wich controller/action and how to capture the users Id. Any tips?


回答1:


I know this is an old question, but the easiest approach is probably to override lock_access! from the lockable mixin (in your user model):

def lock_access!
  super
  # record an account lock here
end


来源:https://stackoverflow.com/questions/5956508/log-incident-when-an-account-is-locked-after-three-failed-attempts-with-devise

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!