title: Session Clash in Laravel 5.7
body: <p>Please I need a guide to solve this issue.</p>
  
  <p>I have an application which sends an email notification to a user when he/she is registered on the application by the System Admin. The newly registered user is expected to click a link in the email and that should take him/her to the login page.</p>
  
  <p>However, I realized that if the the System administrator is still logged in to the application when the newly registered user clicks the link in the email notification, clicking on that link in the email automatically takes the user to the dashboard and he/she is logged in as the System Admin that registered him/her. 
  There is middleware on the login controller as follows:</p>
  
  <pre><code>public function __construct()
  {   
      $this-&gt;middleware('guest')-&gt;except('logout');
  }
  </code></pre>
  
  <p>So, it does not permit a logged in user to get back to the login page. So when the newly created user clicks the link in his email, he is directed to the dashboard of the System Admin if he/she is still logged in.</p>
  
  <p>I guess this is a session problem but I don't know how to resolve it. so I will appreciate any guide to resolve this.</p>
  
  <p>Here is my login script.</p>
  
  <pre><code>&lt;?php
  
      namespace App\Http\Controllers\Auth;
  
      use App\Http\Controllers\Controller;
  
      use Illuminate\Http\Request;
      use Illuminate\Foundation\Auth\AuthenticatesUsers;
  
      use Illuminate\Support\Facades\Auth;
  
      class LoginController extends Controller
      {
      /*
      |--------------------------------------------------------------------------
     | Login Controller
  |--------------------------------------------------------------------------
  |
  | This controller handles authenticating users for the application and
  | redirecting them to your home screen. The controller uses a trait
  | to conveniently provide its functionality to your applications.
  |
  */
  
  use AuthenticatesUsers;
  
  /**
   * Where to redirect users after login.
   *
   * @var string
   */
  protected $redirectTo = '/dashboard';
  
  /**
   * Create a new controller instance.
   *
   * @return void
   */
  public function __construct()
  {   
      $this-&gt;middleware('guest')-&gt;except('logout');
  }
  
   /**
   * The user has been authenticated.
   * Therefore, load up his permissions in session
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  mixed  $user
   * @return mixed
   */
  protected function loadUserRoutes($user)
  {
      $userRoutes=collect([]);
      if(($user-&gt;role-&gt;routes)-&gt;isNotEmpty())
      {
          foreach($user-&gt;role-&gt;routes as $route)
          {
              $userRoutes-&gt;push($route-&gt;name);
          }
      }
  
      session(['userRoutes' =&gt; $userRoutes,'navbar'=&gt;$user-&gt;role_id]);
  }
  
  
  /**
   * Send the response after the user was authenticated.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
  protected function sendLoginResponse(Request $request)
  {
      $request-&gt;session()-&gt;regenerate();
  
      $this-&gt;clearLoginAttempts($request);
      $this-&gt;loadUserRoutes($this-&gt;guard()-&gt;user());
  
      return $this-&gt;authenticated($request, $this-&gt;guard()-&gt;user())
              ?: redirect()-&gt;intended($this-&gt;redirectPath());
  }
  
  /**
   * Attempt to log the user into the application.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return bool
   */
  protected function attemptLogin(Request $request)
  {
      return Auth::attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; 
  $request-&gt;password, 'active' =&gt; '1'], $request-&gt;filled('remember')
      );
    }
  }
  </code></pre>
  
  <p>The notification is generated from a notification method in app/Notifications.
  This is the code for the notification below</p>
  
  <pre><code>&lt;?php
  
  namespace App\Notifications;
  
  use Illuminate\Bus\Queueable;
  use Illuminate\Notifications\Notification;
  use Illuminate\Contracts\Queue\ShouldQueue;
  use Illuminate\Notifications\Messages\MailMessage;
  
  class RegistrationSuccessful extends Notification implements ShouldQueue {
  
  use Queueable;
  
  /**
   * Create a new notification instance.
   *
   * @return void
   */
  
  protected $password;
  protected $name;
  
  public function __construct($password, $name) 
  {
      $this-&gt;password = $password;
      $this-&gt;name = $name;
  }
  
  /**
   * Get the notification's delivery channels.
   *
   * @param  mixed  $notifiable
   * @return array
   */
  public function via($notifiable) 
  {
      return ['mail'];
  }
  
  /**
   * Get the mail representation of the notification.
   *
   * @param  mixed  $notifiable
   * @return \Illuminate\Notifications\Messages\MailMessage
   */
  public function toMail($notifiable) {
      $recipient_name = $this-&gt;name;
      $recipient_password = $this-&gt;password;
      $app_name = config('app.name');
      return (new MailMessage)
                      -&gt;subject("Registration on $app_name")
                      -&gt;greeting("Hello $recipient_name,")
                      -&gt;line("We write to notify you that an account has been opened for you on $app_name")
                      -&gt;line('Your login password is as follows:')
                      -&gt;line("$recipient_password")
                      -&gt;line('You can use this email and the password above to login via the link below')
                      -&gt;action('Login here', url('/login'))
                      -&gt;line('Please contact the head of I.T. department for more information!');
  }
  
  /**
   * Get the array representation of the notification.
   *
   * @param  mixed  $notifiable
   * @return array
   */
  public function toArray($notifiable) {
      return [
              //
      ];
  }
  
  }
  </code></pre>
  
  <p>And I call it somewhere in the application as follows:</p>
  
  <pre><code>$user-&gt;notify(new RegistrationSuccessful($new_password, $user-&gt;name));
  </code></pre>
  
  <p>Thank you.</p>