Beispiel #1
0
 public function action_login()
 {
     // already logged in?
     if (Auth::check()) {
         // yes, so go back to the page the user came from, or the
         // application dashboard if no previous page can be detected
         //Messages::info(__('login.already-logged-in'));
         Response::redirect_back('');
     }
     // was the login form posted?
     if (Input::method() == 'POST') {
         // check the credentials.
         print_r(Input::all());
         if (Auth::login(Input::param('email'), Input::param('password'))) {
             // did the user want to be remembered?
             if (Input::param('remember', false)) {
                 // create the remember-me cookie
                 Auth::remember_me();
             } else {
                 // delete the remember-me cookie if present
                 Auth::dont_remember_me();
             }
             // logged in, go back to the page the user came from, or the
             // application dashboard if no previous page can be detected
             Response::redirect_back('/home');
         } else {
             // login failed, show an error message
             $this->error = 'test';
         }
     }
     // display the login page
     return \View::forge('auth/login');
 }
Beispiel #2
0
 public static function user_login($username_or_email, $password, $is_remember = false)
 {
     if (Auth::instance()->login($username_or_email, $password)) {
         if ($is_remember) {
             Auth::remember_me();
         }
         return true;
     }
     return false;
 }