Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- // Set login credentials
- $credentials = array(
- 'password' => 'test',
- );
- // Try to authenticate the user
- $user = Sentry::authenticate($credentials, false);
- }
- catch (Cartalyst\Sentry\Users\LoginRequiredException $e)
- {
- echo 'Login field is required.';
- }
- catch (Cartalyst\Sentry\Users\PasswordRequiredException $e)
- {
- echo 'Password field is required.';
- }
- catch (Cartalyst\Sentry\Users\WrongPasswordException $e)
- {
- echo 'Wrong password, try again.';
- }
- catch (Cartalyst\Sentry\Users\UserNotFoundException $e)
- {
- echo 'User was not found.';
- }
- catch (Cartalyst\Sentry\Users\UserNotActivatedException $e)
- {
- echo 'User is not activated.';
- }
- // The following is only required if throttle is enabled
- catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e)
- {
- echo 'User is suspended.';
- }
- catch (Cartalyst\Sentry\Throttling\UserBannedException $e)
- {
- echo 'User is banned.';
- }
Advertisement
Add Comment
Please, Sign In to add comment