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,
# return anonymous user when can not find user id = user_id
def self.find user_id
user = User.new
def self.find (*args, &block)
begin
user = super
super
rescue
user = self.anonymous
self.anonymous
end
user
# super
end
# Salts all existing unsalted passwords
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))