|
@@ -37,6 +37,7 @@ function login(){
|
|
|
var url = "https://www.choozmo.com:8887/login";
|
|
|
var username = $('#username').val();
|
|
|
var password = $('#password').val();
|
|
|
+ var regex = new RegExp("^[a-zA-Z0-9 ]+$");
|
|
|
|
|
|
if (username == '' || password == '') {
|
|
|
let title = "登入失敗";
|
|
@@ -57,10 +58,9 @@ function login(){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (/.*[\u4e00-\u9fa5]+.*$/.test(username)) {
|
|
|
+ if (!regex.test(username)) {
|
|
|
let title = "字元有誤";
|
|
|
let text = "名稱僅得包含英文及數字";
|
|
|
-
|
|
|
if (lang == 'en') {
|
|
|
title = "Invalid username!";
|
|
|
text = "Please enter valid username";
|
|
@@ -90,7 +90,7 @@ function login(){
|
|
|
"lockScroll": false,
|
|
|
"overlayZIndex": 10,
|
|
|
"spinnerZIndex": 11
|
|
|
- });
|
|
|
+ });
|
|
|
|
|
|
var data = "grant_type=&username=" + username + "&password="+password+"&scope=&client_id=&client_secret=";
|
|
|
const headers = {
|
|
@@ -124,7 +124,7 @@ function login(){
|
|
|
btnLoginPage.style.display = 'none';
|
|
|
} else if (res.data.access_token!=null && res.data.veri != 'ok') {
|
|
|
var title = "請前往信箱完成驗證";
|
|
|
-
|
|
|
+ JsLoadingOverlay.hide();
|
|
|
if (lang == 'en') { // 英文版訊息
|
|
|
title = "Please check your email box to get validated!"
|
|
|
}
|
|
@@ -147,6 +147,9 @@ function login(){
|
|
|
text: responseOBJ.detail,
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
});
|
|
|
+ window.setTimeout(() => {
|
|
|
+ location.reload();
|
|
|
+ }, 4000)
|
|
|
}
|
|
|
|
|
|
}).catch(err => {
|
|
@@ -161,6 +164,9 @@ function login(){
|
|
|
icon: 'error',
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
});
|
|
|
+ window.setTimeout(() => {
|
|
|
+ location.reload();
|
|
|
+ }, 4000)
|
|
|
})
|
|
|
}
|
|
|
/* var xhr = new XMLHttpRequest();
|