librelist archives

« back to archive

authenticate函数的bug

authenticate函数的bug

From:
Uno Young
Date:
2012-07-12 @ 03:03
 authenticate = function (self, params)
I_AM_CLASS_OR_INSTANCE(self)
 local user
if isInstance(self) then
user = self
else
user = self:getByIndex(params.username)
end
 if not user then return false end

if self.encrypt and type(self.encrypt) == 'function' then
if user:encrypt(params.password) ~= user.password then
return false
end
else
if (params.password):lower() ~= user.password then
return false
end
end
return true, user
end;