refactor user find

This commit is contained in:
alan 2016-03-14 10:46:02 +08:00
parent 0998ca3974
commit 2f5ce553e2
1 changed files with 4 additions and 5 deletions

View File

@ -1066,14 +1066,13 @@ class User < Principal
# refactor User model find function, # refactor User model find function,
# return anonymous user when can not find user id = user_id # return anonymous user when can not find user id = user_id
def self.find user_id def self.find (*args, &block)
user = User.new
begin begin
user = super super
rescue rescue
user = self.anonymous self.anonymous
end end
user # super
end end
# Salts all existing unsalted passwords # Salts all existing unsalted passwords
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password)) # It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))