Example #1
0
 /**
  * Clear authorization token
  *
  * @param Facade $facade
  * @param bool   $clearToken
  */
 private function clearToken(Facade $facade, $clearToken)
 {
     if ($clearToken && $facade->isValid()) {
         $user = $facade->get();
         $user->setToken('');
         $user->save();
     }
 }
Example #2
0
 /**
  * Get Cookies identification data
  *
  * @return array
  */
 private function getCookie()
 {
     $auth = explode('::', $this->request->cookies->get($this->facade->domain));
     if (empty($auth[0]) || empty($auth[1]) || !is_numeric($auth[0])) {
         $this->facade->logout();
         return [];
     }
     return $auth;
 }
Example #3
0
 /**
  * @param array $arguments
  */
 public function __construct(Request $request, Router $router, Facade $user, array $arguments)
 {
     if (!isset($arguments[0]) || empty($arguments[0])) {
         throw new \RuntimeException('Image not specified');
     }
     $this->router = $router;
     $this->request = $request;
     $this->skin = $user->get()->config()->skin;
     $this->prepareAttributes($arguments);
     $this->isModule = isset($arguments[2]) && $arguments[2] === true ? true : false;
     $this->imgTag = isset($arguments[3]) && $arguments[3] === false ? false : true;
     $this->img = $arguments[0];
 }
Example #4
0
 /**
  * Check identification token
  *
  * @param AbstractUser $user
  */
 private function checkToken(AbstractUser $user)
 {
     $token = $user->offsetGet('token', true);
     if (empty($token)) {
         $user->setToken($this->facade->generateToken());
     }
 }
Example #5
0
 /**
  * Check Nickname availability
  *
  * @param string $nickname
  * @return bool
  */
 private function isNicknameAvailable($nickname)
 {
     try {
         $this->facade->findByLogin($nickname);
         throw new InvalidInputException(_g('This Nickname is already taken'));
     } catch (UserExceptionInterface $e) {
         return true;
     }
 }
Example #6
0
 public function __construct(Facade $facade, \PDO $pdo)
 {
     $this->db = $pdo;
     $this->validator = $facade->validate();
 }
Example #7
0
 public function __construct(Request $request, Facade $user)
 {
     $this->request = $request;
     $this->userLocale = $user->get()->config()->lng;
 }