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
0318671d
Commit
0318671d
authored
Nov 26, 2014
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
cf4bb7d7
'
* commit '
cf4bb7d7
': Squashed 'Modules/User/' changes from a0751eb..d4e1225
parents
62e6e9ec
cf4bb7d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
SentryUser.php
Modules/User/Entities/SentryUser.php
+5
-0
SentryAuthentication.php
Modules/User/Repositories/Sentry/SentryAuthentication.php
+43
-2
No files found.
Modules/User/Entities/SentryUser.php
View file @
0318671d
...
...
@@ -16,4 +16,9 @@ class SentryUser extends User
];
protected
$presenter
=
'Modules\User\Presenters\UserPresenter'
;
public
function
groups
()
{
return
$this
->
belongsToMany
(
static
::
$groupModel
,
static
::
$userGroupsPivot
,
'user_id'
);
}
}
Modules/User/Repositories/Sentry/SentryAuthentication.php
View file @
0318671d
<?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.'
;
}
...
...
@@ -110,6 +148,9 @@ class SentryAuthentication implements Authentication
*/
public
function
check
()
{
return
Sentry
::
check
();
if
(
Sentry
::
check
())
{
return
Sentry
::
getUser
();
}
return
false
;
}
}
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