mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-27 03:30:54 +00:00
Fix user hash error
This commit is contained in:
parent
8326a49ccb
commit
8e389ff824
1 changed files with 7 additions and 1 deletions
|
@ -467,7 +467,13 @@ class User < ActiveRecord::Base
|
||||||
case user.password_hash
|
case user.password_hash
|
||||||
when User::PASSWORD_SCRYPT
|
when User::PASSWORD_SCRYPT
|
||||||
# FIXME: If exception occurs here, user cannot log in
|
# FIXME: If exception occurs here, user cannot log in
|
||||||
|
begin
|
||||||
pass = SCrypt::Password.new(user.password)
|
pass = SCrypt::Password.new(user.password)
|
||||||
|
rescue
|
||||||
|
logger.error "User (%s) password hash is invalid."
|
||||||
|
flash[:error] = "Password hash is invalid, please use forget password functionality or contact admin."
|
||||||
|
return nil
|
||||||
|
end
|
||||||
return user if pass == login[:password]
|
return user if pass == login[:password]
|
||||||
when User::PASSWORD_MD5_SCRYPT
|
when User::PASSWORD_MD5_SCRYPT
|
||||||
pass = SCrypt::Password.new(user.password)
|
pass = SCrypt::Password.new(user.password)
|
||||||
|
|
Loading…
Reference in a new issue