Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Benjamin Delespierre
Benjamin Delespierre

Posted on

     

Disable password checks on Laravel

Step 1 update your .env file

Add the following to.env

LOGIN_PASSWORD_CHECK=false
Enter fullscreen modeExit fullscreen mode

Step 2 update your login controller

ChangeApp/Http/Controllers/Auth/LoginController::attemptLogin to

protectedfunctionattemptLogin(Request$request){if(env('LOGIN_PASSWORD_CHECK',true)==false){$this->guard()->login(User::whereEmail($request->input('email'))->firstOrFail());returntrue;}return$this->guard()->attempt($this->credentials($request),$request->filled('remember'));}
Enter fullscreen modeExit fullscreen mode

Step 3 done.

That's it. Now you can login with any password, it will accept it and log into the account designated by the email your provided in the login form.


Bonus if you're using Heroku, add this to yourapp.json to disable password check on review apps:

{"env":{"APP_ENV":"review","LOGIN_PASSWORD_CHECK":"false"}}
Enter fullscreen modeExit fullscreen mode

Tell me what you thin in the comments and don't forget to leave a like!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I do all sorts of mischiefs with Laravel
  • Location
    Paris, France
  • Joined

More fromBenjamin Delespierre

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp