|
|
|
@ -1072,16 +1072,25 @@ class User < Principal
|
|
|
|
|
anonymous_user
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def self.is_id?(id)
|
|
|
|
|
Fixnum===id || id.to_i.to_s == id
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# refactor User model find function,
|
|
|
|
|
# return anonymous user when can not find user id = user_id
|
|
|
|
|
def self.find (*args, &block)
|
|
|
|
|
begin
|
|
|
|
|
return find_by_login(args.first) if args.size==1 && !is_id?(args.first)
|
|
|
|
|
super
|
|
|
|
|
rescue
|
|
|
|
|
self.anonymous
|
|
|
|
|
end
|
|
|
|
|
# super
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def to_param
|
|
|
|
|
login
|
|
|
|
|
end
|
|
|
|
|
# Salts all existing unsalted passwords
|
|
|
|
|
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))
|
|
|
|
|
# This method is used in the SaltPasswords migration and is to be kept as is
|
|
|
|
|