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); }
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'); }
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()); } }