Example #1
0
 public function login($password)
 {
     if (!password::match($password, $this->password)) {
         return false;
     }
     $token = $this->generateToken();
     $key = $this->generateKey($token);
     try {
         $this->update(array('token' => $token));
     } catch (Exception $e) {
         throw new Exception('The authentication token could not be stored.');
     }
     cookie::set('key', $key);
     return true;
 }
Example #2
0
 public function login($password)
 {
     static::logout();
     if (!password::match($password, $this->password)) {
         return false;
     }
     $key = $this->generateKey();
     $secret = $this->generateSecret($key);
     // http only cookie
     cookie::set('kirby', $key, 0, '/', null, false, true);
     s::set('auth.created', time());
     s::set('auth.updated', time());
     s::set('auth.key', $key);
     s::set('auth.secret', $secret);
     s::set('auth.username', $this->username());
     s::set('auth.ip', visitor::ip());
     s::set('auth.ua', visitor::ua());
     return true;
 }
Example #3
0
 public function login($password)
 {
     static::logout();
     if (!password::match($password, $this->password)) {
         return false;
     }
     // create a new session id
     s::regenerateId();
     $key = $this->generateKey();
     $secret = $this->generateSecret($key);
     s::set('kirby_auth_secret', $secret);
     s::set('kirby_auth_username', $this->username());
     cookie::set(s::$name . '_auth', $key, s::$cookie['lifetime'], s::$cookie['path'], s::$cookie['domain'], s::$cookie['secure'], s::$cookie['httponly']);
     return true;
 }