登录提示bug

This commit is contained in:
fanqiang 2013-08-27 22:15:12 +08:00
parent 7350b692d5
commit d043a1fb9d
2 changed files with 9 additions and 1 deletions

View File

@ -176,9 +176,11 @@ class AccountController < ApplicationController
def password_authentication def password_authentication
user = User.try_to_login(params[:username], params[:password]) user = User.try_to_login(params[:username], params[:password])
if user.nil? if user.nil?
invalid_credentials invalid_credentials
elsif user.status == 2
invalid_credentials_new
elsif user.new_record? elsif user.new_record?
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id }) onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
else else
@ -268,6 +270,11 @@ class AccountController < ApplicationController
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash.now[:error] = l(:notice_account_invalid_creditentials) flash.now[:error] = l(:notice_account_invalid_creditentials)
end end
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
flash.now[:error] = l(:notice_account_invalid_creditentials_new)
end
# Register a user for email activation. # Register a user for email activation.
# #

View File

@ -150,6 +150,7 @@ zh:
notice_account_updated: 帐号更新成功 notice_account_updated: 帐号更新成功
notice_account_invalid_creditentials: 无效的用户名或密码 notice_account_invalid_creditentials: 无效的用户名或密码
notice_account_invalid_creditentials_new: 您还未到邮箱激活
notice_account_password_updated: 密码更新成功 notice_account_password_updated: 密码更新成功
notice_account_wrong_password: 密码错误 notice_account_wrong_password: 密码错误
notice_account_register_done: 帐号创建成功,请使用注册确认邮件中的链接来激活您的帐号。 notice_account_register_done: 帐号创建成功,请使用注册确认邮件中的链接来激活您的帐号。