示例#1
0
 public function setUp()
 {
     parent::setUp();
     include __DIR__ . DIRECTORY_SEPARATOR . 'import.php';
     TestsHelper::dbFixture(USERS_TABLE, array(array('login' => self::loginFixture, 'email' => '*****@*****.**', 'password' => PasswordColumn::hash(self::passwordFixture)), array('login' => 'guest', 'email' => '*****@*****.**', 'password' => PasswordColumn::hash(self::passwordFixture))));
     ACL::create(self::testReadRight, '');
     ACL::create(self::testWriteRight, '');
     try {
         SimpleCache::clear(ACLUser::CacheKey);
     } catch (\Exception $e) {
     }
 }
示例#2
0
 /**
  *
  */
 protected function action()
 {
     $oldPassword = $this->getParam('old_password');
     $oldPasswordHash = PasswordColumn::hash($oldPassword);
     $password = $this->getParam('password');
     if ($this->userSession->password->getValue() != $oldPasswordHash) {
         throw new \ForbiddenException('Wrong password');
     }
     $this->userSession->password->setValue($password);
     $this->userSession->update();
     $this->sendNotificationEmail($password);
     return array('status' => true);
 }
示例#3
0
文件: login.php 项目: gudwin/extasy
 /**
  * @param $user
  * @param $password
  *
  * @return bool
  */
 protected static function isAuthPassed($user, $password)
 {
     $authPassed = $user->password->getValue() == PasswordColumn::hash($password);
     if (!$authPassed) {
         // clean up session
         self::unsetSession();
         $error = sprintf('Password incorrect. Login attempt into user account "%s" ', $user->login);
         throw new \ForbiddenException($error);
     }
     $user->time_access->onLogin();
     return $authPassed;
 }