Ejemplo n.º 1
0
 protected function _login()
 {
     $name = Dura::post('name');
     $icon = Dura::post('icon');
     $language = Dura::post('language');
     $name = trim($name);
     $icon = trim($icon);
     $language = trim($language);
     if ($name === '') {
         throw new Exception(t("Please input name."));
     }
     if (mb_strlen($name) > 10) {
         throw new Exception(t("Name should be less than 10 letters."));
     }
     $token = Dura::post('token');
     if (!Dura_Class_Ticket::check($token)) {
         throw new Exception(t("Login error happened."));
     }
     if (!isset($this->icons[$icon])) {
         $icons = array_keys($this->icons);
         $icon = reset($icons);
     }
     $user =& Dura_Class_User::getInstance();
     $user->login($name, $icon, $language);
     Dura_Class_Ticket::destory();
     Dura::redirect('lounge');
 }
Ejemplo n.º 2
0
 protected function _login()
 {
     $name = Dura::post('name');
     $pass = Dura::post('pass');
     $name = trim($name);
     $pass = trim($pass);
     if ($name === '') {
         throw new Exception(t("Please input name."));
     }
     $token = Dura::post('token');
     if (!Dura_Class_Ticket::check($token)) {
         throw new Exception(t("Login error happened."));
     }
     if ($name !== DURA_ADMIN_NAME or $pass !== DURA_ADMIN_PASS) {
         throw new Exception(t("ID or password is wrong."));
     }
     $user =& Dura_Class_User::getInstance();
     $user->login($name, 'admin', DURA_LANGUAGE, true);
     Dura_Class_Ticket::destory();
     Dura::redirect('lounge');
 }