Guest User

Untitled

a guest
May 9th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. try
  2. {
  3.     // Set login credentials
  4.     $credentials = array(
  5.         'email'    => '[email protected]',
  6.         'password' => 'test',
  7.     );
  8.  
  9.     // Try to authenticate the user
  10.     $user = Sentry::authenticate($credentials, false);
  11. }
  12. catch (Cartalyst\Sentry\Users\LoginRequiredException $e)
  13. {
  14.     echo 'Login field is required.';
  15. }
  16. catch (Cartalyst\Sentry\Users\PasswordRequiredException $e)
  17. {
  18.     echo 'Password field is required.';
  19. }
  20. catch (Cartalyst\Sentry\Users\WrongPasswordException $e)
  21. {
  22.     echo 'Wrong password, try again.';
  23. }
  24. catch (Cartalyst\Sentry\Users\UserNotFoundException $e)
  25. {
  26.     echo 'User was not found.';
  27. }
  28. catch (Cartalyst\Sentry\Users\UserNotActivatedException $e)
  29. {
  30.     echo 'User is not activated.';
  31. }
  32.  
  33. // The following is only required if throttle is enabled
  34. catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e)
  35. {
  36.     echo 'User is suspended.';
  37. }
  38. catch (Cartalyst\Sentry\Throttling\UserBannedException $e)
  39. {
  40.     echo 'User is banned.';
  41. }
Advertisement
Add Comment
Please, Sign In to add comment