TransWikia.com

Multiple login forms not working in Laravel

Stack Overflow Asked on November 22, 2021

Laravel 6. PHP 7.4.

I’m building a website. As Laravel offers default Auth Login and Registration forms. I put the login form into my navigation while the registration form on Registration page. Now I want to let users offer another login form onto Registration Page.

I designed another login form and on Submit I referred it to the same login route but it’s not working. Error is 419 page Expired.

I also read about MutiAuth but that is something I’m going to use for my admin panel. Is there any solution?

Registration.blade

<form method="post" action="{{ route('login') }}"  onsubmit="if(document.getElementById('agreed').checked) { return true; } else { alert('Please indicate that you have read and agree to the privacy policy and terms of use'); return false; }">
                                              
<div class="input-group form-group">
 <div class="input-group-prepend">
       <span class="input-group-text"><i class="fas fa-user"></i></span>
 </div>

 <input type="email" required name="email" class="form-control" placeholder="email address">

  </div>
    <div class="input-group form-group">
       <div class="input-group-prepend">
             <span class="input-group-text"><i class="fas fa-key"></i></span>
   </div>
        <input type="password" required name="password" class="form-control" placeholder="password">
    </div>

     <div class="form-group">
        <input type="checkbox" name="checkbox" value="check" id="agreed" />
            <small>I agree to the privacy policy and terms of use</small>
      </div>
       
      <div class="form-group">
         <input type="submit" value="Login" class="btn float-right login_btn">
      </div>
    </form> 

Route

Route::get('login', [
  'as' => 'login',
  'uses' => 'AuthLoginController@showLoginForm'
]);

One Answer

You need to add @csrf inside your <form>.

Answered by Rolf on November 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP