Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Update factory.js #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update factory.js #49

wants to merge 3 commits into from

Conversation

vuurball
Copy link

sum: added required fields, to match the database table constraints which is made by the built-in migration.
this might help new comers save time figuring out

in detail:
when trying to follow the docs it's a bit not clear how to put all the pieces together to create the first user especially for people who aren't familiar with migration, seeding and factories.
I'd even suggest adding UsersSeeder file with the code ready to go.
since following the docs the users table is created by the built-in migration comes with requirement fthat email and password are not null, and email has to be unique, I added those fields to the factory as well, this will allow people to generate multiple users easily

added required fields, to match the database table constraints which is made by the built-in seeder.
this might help new comers save time figuring out
removed the hashing of a password because it's done behind the scenes
@vuurball
Copy link
Author

@thetutlage just wanted to point out that the api docs give example where you has the password
https://adonisjs.com/docs/4.1/seeds-and-factories
and even here it specifically says to hash passwords before saving them
https://adonisjs.com/docs/4.1/authentication#_password_hashing

however after trying to login, i realized that there is hook inside User model which hashes the password , so I was double hashing and it didn't work.
reference adonisjs/core#500

I'm not sure if I misunderstood the intention of the docs, or maybe they need to be fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant