Search code examples
sails.jspassport-local

sails-auth user table has no password field but still validates


I just started working with sails-auth and running it from MySql. I see that the user table it automatically generated doesn't have a password field. Odd. I track down the register(?) method and see that it even deletes the password property before creating the user. So I figure that when you Post to auth/local and give it an email and password that it just checks the email exists and ignores the password (leaving it to the user to tweak this later). But when I login and enter a bad password it won't let me. I have to enter a valid password. How does it know what a valid password is when there is no password in the user table??

Thanks.


Solution

  • User has 1-n relationship with Passport model, which contains password field

    Usually Ideally, credentials are stored in 1-n relationship with User model, when user can login via various methods e.g. password, OAuth etc.