Advertisement
freddy0512

AuthController.php

Aug 16th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. <?php
  2. //    public function postSignin(Request $request)
  3. //    {
  4. //
  5. //    $data = [
  6. //            "username" => $request->input('email'),
  7. //            "password" => $request->input('password')
  8. //          ];
  9. //
  10. //     $respon=GatewayService::login($data);
  11. //
  12. //      if ($respon->status == true)
  13. //      {
  14. //            return redirect('/');
  15. //      }
  16. //      else
  17. //      {
  18. //           return redirect()->back()->with('error', $respon->message);
  19. //      }
  20. //
  21. //    }postSignin
  22.  
  23.     public function postSignin(Request $request)
  24.     {
  25.  
  26.         try {
  27.             // Try to log the user in
  28.             if (Sentinel::authenticate($request->only(['email', 'password']), $request->get('remember-me', false)))
  29.             {
  30.                 // Redirect to the dashboard page
  31.                 return Redirect::route("dashboard")->with('success', Lang::get('auth/message.signin.success'));
  32.             }
  33.  
  34.             $this->messageBag->add('email', Lang::get('auth/message.account_not_found'));
  35.  
  36.         } catch (NotActivatedException $e) {
  37.             $this->messageBag->add('email', Lang::get('auth/message.account_not_activated'));
  38.         } catch (ThrottlingException $e) {
  39.             $delay = $e->getDelay();
  40.             $this->messageBag->add('email', Lang::get('auth/message.account_suspended', compact('delay' )));
  41.         }
  42.  
  43.         // Ooops.. something went wrong
  44.         return back()->withInput()->withErrors($this->messageBag);
  45.     }
  46.  
  47.  
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement