From da7b1aa076f1baf77b3c130d0ada2a2fc867feaf Mon Sep 17 00:00:00 2001 From: akulikov Date: Wed, 21 Jan 2009 13:47:00 +0000 Subject: [PATCH] bitmask realised git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@49 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/User.class.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/classes/User.class.php b/classes/User.class.php index 16396fc..e93adca 100644 --- a/classes/User.class.php +++ b/classes/User.class.php @@ -2,11 +2,11 @@ /** * Класс для работы с пользователями * - * @copyright - * @link + * @copyright + * @link * @package Majestic * @subpackage Decorator - * @since + * @since * @version SVN: $Id$ * @filesource $URL$ */ @@ -19,23 +19,23 @@ class User if (empty($login) || empty($password)) { return false; } - + if(!preg_match("/^[a-z0-9_-]{3,50}$/i", $login)) { return false; } self::setInfo(self::getByLogin(strtolower($login))); - if (!self::getInfo()) { + if (!self::getInfo() || self::$user->isBanned()) { return false; } if(self::$user->pass != $password){ return false; } - + self::setSession(); Load::model('UserData')->loginUpdate($login); - + return true; } @@ -72,11 +72,11 @@ class User static function remember() { self::setInfo(self::getByLogin(Env::getCookie('login'))); - + if (!self::getInfo()) { self::logout(); } - + if (Env::getCookie('login_hash') == self::getHash()) { self::setSession(); } else { @@ -88,12 +88,12 @@ class User { return md5(self::$user->id.'hckrz'.self::$user->login.'mst'.self::$user->pass.'dai'); } - + static function getInfo() { return Env::Session('user', self::$user); } - + static function setInfo($data) { self::$user = $data; @@ -108,27 +108,27 @@ class User { return Load::model('UserData')->getByLogin($login); } - + static function getById($id) { return Load::model('UserData')->getById($id); } - - + + /** * отправляет письмо для активации - * + * * @param string $mail * @param string $login - * + * */ - static function sendActivateMail($mail, $login) + static function sendActivateMail($mail, $login) { $link = 'http://'.Env::Server('SERVER_NAME').'/activate/?key='.Load::model('UserActivate')->generateKey($login, $mail); - + $mailer = new Mailer('UserRegister'); return $mailer->send($mail, "Подтверждени E-mail ".Env::Server('SERVER_NAME'), array('link' => $link, 'site_name' => Env::Server('SERVER_NAME'))); } - + } ?> \ No newline at end of file