Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. const checkPassword = (username, password) => {
  2. return new Promise(async (resolve,reject) => {
  3. try{
  4. const userModel = getUserModel();
  5. const user = await userModel.findOne({where: { username } });
  6. const correctPassword = validPassword(password,user.password);
  7. console.log("sanity check corr password " + correctPassword);
  8. resolve(correctPassword);
  9. //return a token??
  10. }
  11. catch(error) {
  12. reject(error);
  13. }
  14. });
  15. };
  16.  
  17. const isCorrect = await checkPassword(username, password);
  18.  
  19.  
  20. if(correctPassword) {
  21. console.log("LOGIN SUCCESSFULL");
  22. } else {
  23. console.log("LOGIN UNSUCCESSFULL");
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement