Verify that login was successful

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2018-04-30 17:31:14 -04:00
parent 9a318c970c
commit e978568eb7
+8 -3
View File
@@ -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