From bdc98e71071e794d03e05d57e8690030788b5b4a Mon Sep 17 00:00:00 2001 From: Naresh Ch Date: Wed, 30 Nov 2022 10:09:01 +0530 Subject: [PATCH] login authentication changes --- assets/js/login.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/assets/js/login.js b/assets/js/login.js index 3c6e5ae..fd89b31 100644 --- a/assets/js/login.js +++ b/assets/js/login.js @@ -75,11 +75,17 @@ function loginUser(email, password) { fetch(serverUrl + 'account/login', requestOptions) .then((response) => response.text()) .then((result) => { - const user = JSON.parse(result); - setCookie('authentication', user.result.sessionId, 1); - window.location = '../authentication'; + const data = JSON.parse(result); + if (data.status === 0) { + setCookie('authentication', data.result.sessionId, 1); + window.location = '../authentication'; + } else { + passwordErrEl.innerText = data.message; + } }) - .catch((error) => console.log('error', error)); + .catch((error) => { + passwordErrEl.innerText = error; + }); } function validateLogin() {