add login check by regular expression
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@12 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -16,15 +16,19 @@ class User
|
||||
|
||||
static function login($login, $password)
|
||||
{
|
||||
if (empty($login)) {
|
||||
if (empty($login) || empty($password)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! self::$user = self::getByLogin($login) ) {
|
||||
if(!preg_match("/^[a-z0-9_-]{3,20}$/i", $login)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self::$user->password != md5($password)) {
|
||||
if (!self::$user = self::getByLogin(strtolower($login)) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self::$user->pass != $password) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -76,7 +80,7 @@ class User
|
||||
|
||||
static function getHash()
|
||||
{
|
||||
return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->password.'dai');
|
||||
return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai');
|
||||
}
|
||||
|
||||
static function getInfo()
|
||||
|
Reference in New Issue
Block a user