]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Auth/AuthController.php
Found the source of the issue, not sure how to fix
[bookstack] / app / Http / Controllers / Auth / AuthController.php
index 21abfb24c84950675f725c9ae2a7d104007ac573..fef87d5c87cff3a6759a6b835c0eb496fc29d79d 100644 (file)
@@ -118,17 +118,20 @@ class AuthController extends Controller
      */
     protected function authenticated(Request $request, Authenticatable $user)
     {
-        if(!$user->exists && $user->email === null && !$request->has('email')) {
+        // Explicitly log them out for now if they do no exist.
+        if (!$user->exists) auth()->logout($user);
+
+        if (!$user->exists && $user->email === null && !$request->has('email')) {
             $request->flash();
             session()->flash('request-email', true);
             return redirect('/login');
         }
 
-        if(!$user->exists && $user->email === null && $request->has('email')) {
+        if (!$user->exists && $user->email === null && $request->has('email')) {
             $user->email = $request->get('email');
         }
 
-        if(!$user->exists) {
+        if (!$user->exists) {
             $user->save();
             $this->userRepo->attachDefaultRole($user);
             auth()->login($user);
@@ -188,6 +191,7 @@ class AuthController extends Controller
         }
 
         $newUser->email_confirmed = true;
+
         auth()->login($newUser);
         session()->flash('success', 'Thanks for signing up! You are now registered and signed in.');
         return redirect($this->redirectPath());