Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/12/2014, 20:24
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Respuesta: como enviar a vista mensaje de excepcion

Osea que lo mas sencillo es hacerlo asi:

Código PHP:
Ver original
  1. public function postLogin()
  2.     {
  3.    
  4. try
  5. {
  6.  
  7.     $credentials = array(
  8.         'email'    => '[email protected]',
  9.         'password' => 'password',
  10.     );
  11.  
  12.     $user = Sentry::authenticate($credentials, false);
  13. }
  14. catch (Cartalyst\Sentry\Users\LoginRequiredException $e)
  15. {
  16.  
  17.      $error = 'Login field is required.';
  18. }
  19. catch (Cartalyst\Sentry\Users\PasswordRequiredException $e)
  20. {
  21.     $error = 'Password field is required.';
  22. }
  23. catch (Cartalyst\Sentry\Users\WrongPasswordException $e)
  24. {
  25.    $error = 'Wrong password, try again.';
  26. }
  27. catch (Cartalyst\Sentry\Users\UserNotFoundException $e)
  28. {
  29.    $error = 'User was not found.';
  30. }
  31. catch (Cartalyst\Sentry\Users\UserNotActivatedException $e)
  32. {
  33.     $error = 'User is not activated.';
  34. }
  35.  
  36.  
  37. catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e)
  38. {
  39.     $error = 'User is suspended.';
  40. }
  41. catch (Cartalyst\Sentry\Throttling\UserBannedException $e)
  42. {
  43.     $erro =  'User is banned.';
  44. }
  45.  
  46. return Redirect::to('/')->with('error_message', $error);
  47.  
  48.     }