Esempio n. 1
0
 /**
  * Get notifications
  * @return string       value
  */
 public static function get()
 {
     if ($message = Cookie::get('__notification')) {
         // Delete the cookie!
         Power::off(function () {
             Cookie::delete('__notification');
         });
     }
     return $message;
 }
Esempio n. 2
0
 /**
  * Logs in the user
  * @param  string  $finder   finder column
  * @param  string  $password password used to authenticate the user
  * @param  boolean $remember session or cookie
  * @return NULL
  */
 public function login($finder = null, $password = null, $remember = false)
 {
     $user = $this->_userModel->where($this->_config['finder'], $finder)->first();
     if ($user === null) {
         throw new AuthException(ucfirst($this->_config['finder']) . ' does not exist');
     }
     if ($password === null) {
         throw new AuthException('Password cannot be empty');
     }
     // Tarpit alert!
     // Let PHP sleep for just one seconds, prevend DoS-attacks (becase, takes too long)
     // and stresses the shit out of k1dd0z
     sleep(1);
     if (password_verify($password, $user->password)) {
         Cookie::set('stativo_auth_session', $user->token, $remember ? 2592000 : null);
         // one month!
         return true;
     } else {
         return false;
     }
 }