Browse Source

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@23 4cb57b5f-5bbd-dd11-951b-001d605cbbc5

master
ejikharev 16 years ago
parent
commit
e66b8410a7
  1. 26
      classes/User.class.php

26
classes/User.class.php

@ -24,19 +24,18 @@ class User
return false;
}
if (!self::$user = self::getByLogin(strtolower($login)) ) {
self::setInfo(self::getByLogin(strtolower($login)));
if (!self::getInfo()) {
return false;
}
if (stripslashes(self::$user->pass) != $password) {
return false;
}
if (!self::isActive(self::$user->id)) {
return false;
}
self::setSession();
self::setSession();
Load::model('UserData')->loginUpdate($login);
return true;
}
@ -54,6 +53,7 @@ class User
{
if (Env::getCookie(session_name())) { //есть сессия
session_start();
self::setInfo(Env::Session('user'));
} elseif (Env::getCookie('login') && Env::getCookie('login_hash')) {
self::remember();
}
@ -71,7 +71,9 @@ class User
static function remember()
{
if (! self::$user = self::getByLogin(Env::getCookie('login'))) {
self::setInfo(self::getByLogin(Env::getCookie('login')));
if (!self::getInfo()) {
self::logout();
}
@ -91,6 +93,11 @@ class User
{
return Env::Session('user', self::$user);
}
static function setInfo($data)
{
self::$user = $data;
}
static function isGuest()
{
@ -102,9 +109,10 @@ class User
return Load::model('UserData')->getByLogin($login);
}
static function isActive($user_id)
static function getById($id)
{
return Load::model('UserActivate')->isActive($user_id);
return Load::model('UserData')->getById($id);
}
}
?>
Loading…
Cancel
Save