Przeglądaj źródła

login authentication changes

Naresh Ch 2 lat temu
rodzic
commit
bdc98e7107
1 zmienionych plików z 10 dodań i 4 usunięć
  1. 10
    4
      assets/js/login.js

+ 10
- 4
assets/js/login.js Wyświetl plik

75
   fetch(serverUrl + 'account/login', requestOptions)
75
   fetch(serverUrl + 'account/login', requestOptions)
76
     .then((response) => response.text())
76
     .then((response) => response.text())
77
     .then((result) => {
77
     .then((result) => {
78
-      const user = JSON.parse(result);
79
-      setCookie('authentication', user.result.sessionId, 1);
80
-      window.location = '../authentication';
78
+      const data = JSON.parse(result);
79
+      if (data.status === 0) {
80
+        setCookie('authentication', data.result.sessionId, 1);
81
+        window.location = '../authentication';
82
+      } else {
83
+        passwordErrEl.innerText = data.message;
84
+      }
81
     })
85
     })
82
-    .catch((error) => console.log('error', error));
86
+    .catch((error) => {
87
+      passwordErrEl.innerText = error;
88
+    });
83
 }
89
 }
84
 
90
 
85
 function validateLogin() {
91
 function validateLogin() {

Ładowanie…
Anuluj
Zapisz