public function signIn() { $_action = 'signin'; $_viewtype = 'traveler/signin'; $_viewdata = array('env' => $this->_env, 'action' => $_action); if (Auth::check()) { return Redirect::to('me/'); } else { // pas connecté if (Request::isMethod('post')) { $email = Input::get('email'); $password = Input::get('password'); if (!empty($email) && !empty($password)) { $email = Input::get('email'); $pass = sha1(Input::get('password')); } $dbuser = Traveler::where('email', '=', $email)->first(); if (!$dbuser) { $_viewdata['error'] = array('code' => "invalidemail"); } elseif ($pass == $dbuser->password) { $user = Traveler::find($dbuser->id); Auth::login($user); return Redirect::to('me/'); } else { $_viewdata['error'] = array('code' => "invalidpw"); } } if (Request::isMethod('get') || Request::isMethod('post')) { return View::make($_viewtype, $_viewdata); } } }