From the course: React: Authentication

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Solution: Adding salt and pepper

Solution: Adding salt and pepper - React.js Tutorial

From the course: React: Authentication

Solution: Adding salt and pepper

(upbeat music) - All right, well hopefully you gave this challenge a try. So let's take a look at the solution. So what I did here is I started off, obviously the salt and pepper password function. I started off from scratch. And really all we had to do here was take the pepper and the salt and kind of decide where we wanted to put them, or how we wanted to add them to this password. So really the easiest thing you could have done here was you could have said, you know, return, and then we could have generated the salt. So we'll do that on a line above that. So I said, "const salt =" and then we'll just say, "generateRandomSalt." Use this one down here. So "generateRandomSalt" like so. And now that we have the salt, what we can do is we can just return that salt, obviously. And for the password we're going to have to say, well, here, we'll say "result," just 'cause that was what we said in the instructions there. And we could just add the password, plus the salt, plus the pepper. And…

Contents