Exemple #1
0
 public function POST()
 {
     if (!($user = \Model\User::login(post('email'), post('passwd'), post('remember')))) {
         return $this->render('login', array('message' => '错误的用户名或密码'));
     }
     $url = get('ref') ?: '/';
     return resp()->redirect($url);
 }
Exemple #2
0
 public function post()
 {
     if ($user = User::login(post('email'), post('passwd'))) {
         $next = get('ref') ?: '/user';
         return app()->redirect($next);
     }
     return app()->redirect(req()->referer() ?: '/login');
 }
Exemple #3
0
 public function index()
 {
     // -- ** -- GET Twig & city list
     $twig = Config::getTwig();
     if (isset($_POST["mail"]) && isset($_POST["pass"])) {
         $loginResult = User::login($_POST["mail"], $_POST["pass"]);
         //die($_SERVER['REQUEST_URI']);
         // -- ** -- Check $cityList content is exist with isset method
         $result = array('user' => $loginResult->content);
         // -- ** -- Render result with twig
         if ($loginResult->isSuccess()) {
             header("Location: index.php");
         } else {
             return $twig->render('admin/pages/examples/login.html', $result);
         }
     } else {
         return $twig->render('admin/pages/examples/login.html', array());
     }
 }