예제 #1
0
 /**
  * Attempt to do login
  *
  */
 public function postLogin()
 {
     //$repo = App::make('UserRepository');
     $input = Input::all();
     /*$input = array(
           'username'              =>Input::get('username'),
           'password'              =>Input::get('password'),            
       );*/
     $err_msg = "";
     if ($this->userRepo->login($input)) {
         //return Redirect::intended('/');
         //Administratorul platformei si utilizatorii care au acces la aplicatia vor putea continua
         if (Entrust::can('administrare_platforma') || $this->userRepo->hasAccessApp(1)) {
             if (Entrust::can('hostinger')) {
                 return Redirect::intended('/proba');
             } else {
                 self::registerLogin(Input::get('username'), Input::get('password'), 'Login OK');
                 Confide::getDepartamente();
                 return Redirect::intended('/dashboard');
             }
         } else {
             //altfel se afiseaza mesajul de eroare si sunt redirectionati la pagina de login
             $err_msg = Lang::get('confide::confide.alerts.access_denied');
         }
     } else {
         if ($this->userRepo->isThrottled($input)) {
             $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
         } elseif ($this->userRepo->existsButNotConfirmed($input)) {
             $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
         } elseif ($this->userRepo->isUserBlocked($input)) {
             $err_msg = Lang::get('confide::confide.alerts.user_blocked');
         } else {
             $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
         }
     }
     self::registerLogin(Input::get('username'), Input::get('password'), $err_msg);
     return Redirect::to('user/login')->withInput(Input::except('password'))->with('error', $err_msg);
 }