Verifying Passwords
For verifying passwords, we must get the hashed password from the database, hash the password passed in by the user for the login, and then compare them. The nuance around verifying passwords is beyond the scope of this book as cryptography is an entire field of itself. For our verify process, although verifying passwords does not have any direct relation to storing data, I am going to put the verifying password logic in the schema.rs
in our data access layer. This is where I choose to break by rule around putting logic in a defined context. The verifying of the password does make sense to be in the core, however, the hashing of the password to be stored is already in the schema.rs
in our data access layer. A developer looking at our schema.rs
in our data access layer will quickly see how the password is hashed for storage and how the password is verified. If there was a lot more complexity around verifying a password to the point it needed an entire module, then it...