Esempio n. 1
0
 public function signout()
 {
     Logger::getInstance()->info('Signout {token}', array('token' => self::model()->session()->token->val()));
     self::model()->cookie()->destroy();
     self::model()->session()->destroy();
     Http::redirect(Router::link());
 }
Esempio n. 2
0
 public function __initView()
 {
     http_response_code(403);
     if (!$this->message) {
         $this->message = Libs\I18n::__('From htaccess');
     }
     Logger::getInstance()->error('Error 403: {message}', array('message' => $this->message));
 }
Esempio n. 3
0
 public function signin()
 {
     if (Request::env('POST')->email->exists()) {
         if (Request::env('POST')->password->exists()) {
             if ($id = self::model()->exists(Request::env('POST')->email->val(), Request::env('POST')->password->val())) {
                 Logger::getInstance()->info('Signin {admin}', array('admin' => Request::env('POST')->email->val()));
                 self::model()->session()->id = $id;
                 self::model()->session()->token = Token::get($id);
                 $url = SJO_BASEHREF;
                 if (preg_match('#^(\\./|/)#', Request::env('GET')->redirect->val())) {
                     $url = Request::env('GET')->redirect->val();
                 }
                 Http::redirect($url);
             } else {
                 Alert::set(Lib\I18n::__('Les informations de connexion sont incorrects'));
             }
         } else {
             Alert::set(Lib\I18n::__('Veuillez renseigner votre mot de passe'));
         }
     } else {
         Alert::set(Lib\I18n::__('Veuillez renseigner votre identifiant'));
     }
 }