Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Promise in Handler #12

Open
RohanSSS opened this issue Apr 19, 2019 · 0 comments
Open

Unhandled Promise in Handler #12

RohanSSS opened this issue Apr 19, 2019 · 0 comments

Comments

@RohanSSS
Copy link

the calling of bcrypt.compare on line 29 of the handler will return a promise due to the fact that you haven't given it a callback

const isMatch = bcrypt.compare(password, storedPassword);

This is currently unhandled since you've not done a .then() after it.

if you want to assign the result to a variable you would have to use bcrypt.compareSync

the way its currently set up is that it will call the promise in both if statements running through both and slowing down the code due to the fact it has to do the compare twice.

bcrypt.compare(password, storedPassword)
    .then(res => {do stuff here})

will take the resolve from the comparison forward at which point you could do the checking for whether it was true or false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant