From e978568eb7b5b918f8f5e52333efdd102b005fdd Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Mon, 30 Apr 2018 17:31:14 -0400 Subject: [PATCH] Verify that login was successful Signed-off-by: Mcat12 --- src/views/Login.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/views/Login.js b/src/views/Login.js index ea4c69c..c877c64 100644 --- a/src/views/Login.js +++ b/src/views/Login.js @@ -42,9 +42,14 @@ export default class Login extends Component { hashedPassword = sha("sha256").update(hashedPassword).digest("hex"); api.authenticate(hashedPassword) - .then(() => { - // Assume it's ok since there was no error - // TODO: verify response + .then(data => { + // Verify status + if(data.status !== "success") { + console.log("Failed to log in:"); + console.log(data); + return; + } + api.loggedIn = true; // Redirect to the page the user was originally going to, or if that doesn't exist, go to home