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