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

Need to implement error first callback #62

Open
helenzhou6 opened this issue Apr 12, 2018 · 0 comments
Open

Need to implement error first callback #62

helenzhou6 opened this issue Apr 12, 2018 · 0 comments
Labels

Comments

@helenzhou6
Copy link
Collaborator

helenzhou6 commented Apr 12, 2018

HEII-topics/src/handler.js

Lines 156 to 159 in 5a2f685

getUserData(username, (err, dbResponse) => {
const user = dbResponse[0];
if (user) {
bcrypt.compare(password, user.password, (err, compare) => {

And

HEII-topics/src/handler.js

Lines 193 to 203 in 5a2f685

getUserData(username, (err, res) => {
if (!res) {
addErrorCookie(
response,
'bad luck, that username is already taken, pick another!'
);
} else {
bcrypt.hash(password, 8, (err, hashedPassword) => {
if (err) {
console.log(err);
}

--> These functions need error handling at the beginning

if(err) {
   addErrorCookie(response, 'sorry there was en error on our end trying to process your request');
} else {
 // do this
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant