示例#1
0
 public function _login()
 {
     if ($this->is_admin_logged_in()) {
         $this->redirect_to_admin_dashboard();
     } else {
         if ($this->request->is_post()) {
             $user = \zing\cms\auth\ZingUser::authenticate_by_username($this->params['username'], $this->params['password']);
             if ($user) {
                 $this->log_in_admin($user);
                 $this->flash('success', 'Login successful');
                 $this->redirect_to_admin_dashboard();
             } else {
                 $this->flash_now('error', 'Invalid username/password');
             }
         }
     }
 }