Advertisement
freddy0512

AuthController.php

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