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

Seed login

Share and receive seeds within the
Exchange community of gardeners.

If you are already a member of the
Community Seed Network site, you
do not need to register. Go to Sign in
and use your CSN login.

If you are already a participant, sign in using your
email and password. If you forgot your password,
click the ‘Forgot pasword?’ link below.

The Seed Exchange

Part of the Seed Savers
Exchange community.

Seed Savers Exchange is a tax-exempt 501(c)3 nonprofit organization dedicated to the preservation of heirloom seeds.

Contact Us:

3094 North Winn Rd.
Decorah, IA 52101
(563) 382-5990

xpath://content/page/@description