Exemple #1
0
 public function post()
 {
     $f3 = \Base::instance();
     $userId = User::getUserId($f3->get("POST.username"));
     if ($userId) {
         if (User::verifyUserPassword($userId, $f3->get("POST.password"))) {
             $user = User::getUser($userId);
             // Check if the user is suspended
             if ($user->suspended_time != null) {
                 $f3->set('error', sprintf('Your account is suspended since %s, check your email.', $user->suspended_time));
             } else {
                 // GO GO GO !
                 $f3->set('SESSION.id', $user->id);
                 $f3->reroute("/dashboard");
                 return;
             }
         } else {
             $f3->set('error', 'Wrong username/password combination');
         }
     } else {
         $f3->set('error', 'Wrong username/password combination');
     }
     $f3->set('css', array('/static/css/auth.css'));
     $f3->set('target', 'auth/login.html');
     $this->_render('base.html');
 }