Categories
BLOG

seed login

Laravel 5 db:seed the username and password, but not authenticating on login

I have implemented Database seeder to seed in user (default) credentials.

After running seed, I got success message. But when I try to make login, it says your credential are not matching. Is there any particular reason for this. Can’t we seed user data with bcrypt??

3 Answers 3

If we talk about the default AuthController of Laravel 5 obviously no you can’t:

If you have a look at the create() function you can see that the data submitted as password is automatically bcrypted. So if you bcrypt the password too it is bcrypted a second time.

I inserted the data into my user table from my seeder as so:

This works for me and I am able to log in while using the default auth controller.

Alright, some key points :

If you’re using the User model for seeding, make sure that you’r not hashing the password twice that could happen if you have a mutator set in your model for the password column.

Be aware of your saved passwords in the browser, prefer writing explicitly your username and password (in this case).

Finally check if there is no typo in your username/email or password. (that was my case 🤦‍♂️)

Laravel 5 db:seed the username and password, but not authenticating on login I have implemented Database seeder to seed in user (default) credentials. After running seed, I got success

Login Page

Engage your students,

bring a program to your class

Inspire with your expertise,

volunteer as an ambassador

Continue the outreach,

make a donation

Newsletter

Location

First the Seed Foundation
1701 Duke St. Suite 275
Alexandria, VA 22314

Phone

Links

  • Donate
  • Site Map
  • Privacy Policy

Social

© Copyright 2016 First The Seed Foundation

Privacy Overview

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.

First the Seed Foundation is a not-for-profit organization established by the ASTA to inform consumers and workers about the importance of the seed industry