public function store()
 {
     //Create the (user)
     $email = Input::get('email');
     $password = Input::get('password');
     if (!User::loginIsValid(Input::all())) {
         return Redirect::back()->withInput()->withErrors(User::$errors);
     }
     if (Auth::attempt(array('email' => $email, 'password' => $password), true)) {
         return Redirect::route('tasks.index');
     }
     return Redirect::route('pages.index');
 }
Example #2
0
 function login()
 {
     $email = $_POST['login_email'];
     $password = $_POST['login_password'];
     $id = User::getIdByEmail($email);
     if (!User::loginIsValid($email, md5($password))) {
         throw new Exception("Error when loggin in user.");
     }
     if (!User::accountIsActivated($id)) {
         echo "Your account has not yet been activated. Click \r\n\t\t\tthe link in the confirmation email which was sent to your email account when you registered";
         return;
     }
     $this->session->set_userdata('userid', $id);
     redirect('/main');
 }