Created
January 5, 2017 16:35
-
-
Save anonymous/7b125a5b3e79e86e81192ef59f164201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.post('/login', async (ctx, next) => { | |
let username = ctx.request.body.username; | |
let password = ctx.request.body.password; | |
console.log(ctx.request.body.username); | |
try{ | |
let infoUser = await db.query("SELECT password from utilizador WHERE username = '"+ username+"'",true); | |
if(infoUser.length > 0) { | |
//TODO check password | |
console.log(infoUser); | |
ctx.body = getToken(username, password); | |
} | |
else{ | |
ctx.response.status = 200; | |
ctx.body = { | |
result: "NOT" | |
}// MIsssing errors | |
} | |
} | |
catch(err){ | |
console.log(err); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment