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

Hola amigos, tengo el siguiente metodo para autenticar un usuario y utilizo la libreria sentry como puedo enviar a la vista el mensaje de la excepcion?


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.     echo 'Login field is required.';
  17. }
  18. catch (Cartalyst\Sentry\Users\PasswordRequiredException $e)
  19. {
  20.     echo 'Password field is required.';
  21. }
  22. catch (Cartalyst\Sentry\Users\WrongPasswordException $e)
  23. {
  24.     echo 'Wrong password, try again.';
  25. }
  26. catch (Cartalyst\Sentry\Users\UserNotFoundException $e)
  27. {
  28.     echo 'User was not found.';
  29. }
  30. catch (Cartalyst\Sentry\Users\UserNotActivatedException $e)
  31. {
  32.     echo 'User is not activated.';
  33. }
  34.  
  35. catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e)
  36. {
  37.     echo 'User is suspended.';
  38. }
  39. catch (Cartalyst\Sentry\Throttling\UserBannedException $e)
  40. {
  41.     echo 'User is banned.';
  42. }
  43. return Redirect::to('/');
  44. }