|
@@ -8,6 +8,7 @@ const btnUserProfile_d = document.querySelector('.login-top .btn-userProfile');
|
|
|
const btnLogout_d= document.querySelector('.login-top .btn-logout');
|
|
|
|
|
|
$('.psd_visible').hide();
|
|
|
+$('.loading').hide();
|
|
|
|
|
|
$('.psd_invisible').click(function(){
|
|
|
$(this).prev().toggle();
|
|
@@ -76,28 +77,14 @@ function login(){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- JsLoadingOverlay.show({
|
|
|
- "overlayBackgroundColor": "#666666",
|
|
|
- "overlayOpacity": 0.6,
|
|
|
- "spinnerIcon": "ball-circus",
|
|
|
- "spinnerColor": "#000",
|
|
|
- "spinnerSize": "3x",
|
|
|
- "overlayIDName": "overlay",
|
|
|
- "spinnerIDName": "spinner",
|
|
|
- "offsetX": 0,
|
|
|
- "offsetY": 0,
|
|
|
- "containerID": null,
|
|
|
- "lockScroll": false,
|
|
|
- "overlayZIndex": 10,
|
|
|
- "spinnerZIndex": 11
|
|
|
- });
|
|
|
|
|
|
var data = "grant_type=&username=" + username + "&password="+password+"&scope=&client_id=&client_secret=";
|
|
|
const headers = {
|
|
|
"accept": "application/json",
|
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
|
}
|
|
|
-
|
|
|
+ $('.loading').show();
|
|
|
+ console.log(data);
|
|
|
axios({
|
|
|
method: 'post',
|
|
|
url: url,
|
|
@@ -106,7 +93,6 @@ function login(){
|
|
|
}).then(res => {
|
|
|
console.log(res.data);
|
|
|
document.cookie = 'jwt_token='+res.data.access_token;
|
|
|
- JsLoadingOverlay.hide();
|
|
|
if(res.data.access_token!=null && res.data.veri == 'ok') {
|
|
|
var title = "登入成功";
|
|
|
if (lang == 'en') { // 英文版訊息
|
|
@@ -118,13 +104,15 @@ function login(){
|
|
|
icon: 'success',
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
});
|
|
|
+ $('.loading').hide();
|
|
|
window.setTimeout(() => {
|
|
|
window.location.href = 'user_profile2.html';
|
|
|
}, 2000);
|
|
|
btnLoginPage.style.display = 'none';
|
|
|
+
|
|
|
} else if (res.data.access_token!=null && res.data.veri != 'ok') {
|
|
|
var title = "請前往信箱完成驗證";
|
|
|
- JsLoadingOverlay.hide();
|
|
|
+ $('.loading').hide();
|
|
|
if (lang == 'en') { // 英文版訊息
|
|
|
title = "Please check your email box to get validated!"
|
|
|
}
|
|
@@ -137,7 +125,7 @@ function login(){
|
|
|
});
|
|
|
} else {
|
|
|
var title = "登入失敗";
|
|
|
- JsLoadingOverlay.hide();
|
|
|
+ $('.loading').hide();
|
|
|
if (lang == 'en') { // 英文版訊息
|
|
|
title = "Login Failed!"
|
|
|
}
|
|
@@ -147,9 +135,7 @@ function login(){
|
|
|
text: responseOBJ.detail,
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
});
|
|
|
- window.setTimeout(() => {
|
|
|
- location.reload();
|
|
|
- }, 4000)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}).catch(err => {
|
|
@@ -164,9 +150,7 @@ function login(){
|
|
|
icon: 'error',
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
});
|
|
|
- window.setTimeout(() => {
|
|
|
- location.reload();
|
|
|
- }, 4000)
|
|
|
+ $('.loading').hide();
|
|
|
})
|
|
|
}
|
|
|
/* var xhr = new XMLHttpRequest();
|