Learn how to use the bcrypt package to validate a user’s password.
- [Instructor] So in this video … we're going to be completing the login process … by validating the user's password. … First open a new terminal window, … and run npm install axios dash dash save. … That's going to be the library that we're going to use … to make http requests to our server. … So go inside of dev-server, and then into your user-model. … And below this, the virtual method, … we're going to set something called statics. … And basically what that is, … is methods that you want to use in your userSchema, … and you can use it anywhere throughout your application. … And so you can easily define one by saying userSchema, … or the name of your schema, dot statics. … And then you call the function whatever you want, … so I'll name mine passwordMatches. … And so you assign it a function, … and then inside of there I'll pass in the two passwords. … The password that the user provides, … and then the encrypted one. … So now I can return bcrypt.compareSync, … and then pass in those two. …
- Single-page applications and Vue.js
- Preparing your development environment
- Creating a Vue.js application
- Using the Vue.js router
- Building a RESTful back-end API with Node.js and Express.js
- Connecting to MongoDB
- Validating and managing a user session
- Connecting Vue.js to a back-end server
Skill Level Intermediate
1. Getting to Know the MEVN Stack
2. Preparing Your Development Environment
3. Vue.js Core Concepts
4. Building a RESTful Back-End API with Node.js and Express.js
Check HTTP status codes3m 17s
5. Connecting Your Application to MongoDB
6. User Authentication, JWTs, and Session Management
7. Finalizing Your Application
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.