Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2016-04-03 11:16:49 +0100
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
4caa61fe96537a88636af4cc6c8893b5b91aaaef
4caa61fe
1 parent
c5960f9b
Added a friendlier error for LDAP new user mismatches
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
app/Exceptions/AuthException.php
app/Http/Controllers/Auth/AuthController.php
app/Exceptions/AuthException.php
0 → 100644
View file @
4caa61f
<?php
namespace
BookStack\Exceptions
;
class
AuthException
extends
PrettyException
{}
\ No newline at end of file
app/Http/Controllers/Auth/AuthController.php
View file @
4caa61f
...
...
@@ -2,6 +2,8 @@
namespace
BookStack\Http\Controllers\Auth
;
use
BookStack\Exceptions\AuthException
;
use
BookStack\Exceptions\PrettyException
;
use
Illuminate\Contracts\Auth\Authenticatable
;
use
Illuminate\Http\Request
;
use
BookStack\Exceptions\SocialSignInException
;
...
...
@@ -115,6 +117,7 @@ class AuthController extends Controller
* @param Request $request
* @param Authenticatable $user
* @return \Illuminate\Http\RedirectResponse
* @throws AuthException
*/
protected
function
authenticated
(
Request
$request
,
Authenticatable
$user
)
{
...
...
@@ -132,6 +135,13 @@ class AuthController extends Controller
}
if
(
!
$user
->
exists
)
{
// Check for users with same email already
$alreadyUser
=
$user
->
newQuery
()
->
where
(
'email'
,
'='
,
$user
->
email
)
->
count
()
>
0
;
if
(
$alreadyUser
)
{
throw
new
AuthException
(
'A user with the email '
.
$user
->
email
.
' already exists but with different credentials.'
);
}
$user
->
save
();
$this
->
userRepo
->
attachDefaultRole
(
$user
);
auth
()
->
login
(
$user
);
...
...
Please
register
or
sign in
to post a comment