【发布时间】:2017-07-24 17:56:00
【问题描述】:
我创建了会话控制器,我正在关注this。
我已经在模型中添加了可锁定策略并运行rails db:migrate
我想在不使用warden.authenticate 的情况下更新失败的尝试
我阅读了设计文档、可锁定策略并找到了 valid_for_authentication 方法。
我必须如何使用 valid_for_authentication? 如果它为零,我只是跳过登录,但我想更新失败的尝试。我错过了什么方法?
def create
@user = User.authenticate(params[:user][:email], params[:user][:password])
sign_in(:user, @user) if @user&.valid_for_authentication?
redirect_to root_path
end
【问题讨论】:
标签: ruby-on-rails devise