Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
156a1444
Commit
156a1444
authored
Nov 26, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catching sentry exceptions
parent
2bb152dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
SentryAuthentication.php
Modules/User/Repositories/Sentry/SentryAuthentication.php
+39
-1
No files found.
Modules/User/Repositories/Sentry/SentryAuthentication.php
View file @
156a1444
<?php
namespace
Modules\User\Repositories\Sentry
;
use
Cartalyst\Sentry\Throttling\UserBannedException
;
use
Cartalyst\Sentry\Throttling\UserSuspendedException
;
use
Cartalyst\Sentry\Users\LoginRequiredException
;
use
Cartalyst\Sentry\Users\PasswordRequiredException
;
use
Cartalyst\Sentry\Users\UserNotActivatedException
;
use
Cartalyst\Sentry\Users\UserNotFoundException
;
use
Cartalyst\Sentry\Users\WrongPasswordException
;
use
Modules\Core\Contracts\Authentication
;
use
Cartalyst\Sentry\Facades\Laravel\Sentry
;
...
...
@@ -13,9 +20,40 @@ class SentryAuthentication implements Authentication
*/
public
function
login
(
array
$credentials
,
$remember
=
false
)
{
if
(
Sentry
::
authenticate
(
$credentials
,
$remember
))
{
try
{
Sentry
::
authenticate
(
$credentials
,
$remember
);
return
false
;
}
catch
(
LoginRequiredException
$e
)
{
return
'Login field is required.'
;
}
catch
(
PasswordRequiredException
$e
)
{
return
'Password field is required.'
;
}
catch
(
WrongPasswordException
$e
)
{
return
'Wrong password, try again.'
;
}
catch
(
UserNotFoundException
$e
)
{
return
'User was not found.'
;
}
catch
(
UserNotActivatedException
$e
)
{
return
'User is not activated.'
;
}
catch
(
UserSuspendedException
$e
)
{
return
'User is suspended.'
;
}
catch
(
UserBannedException
$e
)
{
return
'User is banned.'
;
}
return
'Invalid login or password.'
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment