public function index() { //If the register form was sent if (Form::exists('login_form')) { //Check if User exists $user = Client::getOneBy(array('_mail' => Form::get('mail'))); //Confirm if PW matches if ($user && $user->getPassword() == Client::encryptPassword(Form::get('password'))) { Session::connect($user); return \App\Component\Redirect::to('/'); } $error = "Vos informations de connexion sont incorrects. Merci de réessayer."; return View::render("login/index.php", array('error' => $error)); } return View::render("index/index.php"); }