登录事故发生时,帐户被锁定三次尝试失败后与设计 [英] Log incident when an account is locked after three failed attempts with Devise

查看:263
本文介绍了登录事故发生时,帐户被锁定三次尝试失败后与设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要记录在数据库中,当用户帐户被锁定,我使用Rails3中,并制定了事件,所以我想我会需要重写的控制器设计一些动作,我只是不知道至极控制器/动作以及如何捕捉用户标识。任何提示?

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?

推荐答案

我知道这是一个老问题,但最简单的方法可能是覆盖lock_access!从可锁定混入(在你的用户模型):

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

这篇关于登录事故发生时,帐户被锁定三次尝试失败后与设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆