gant-core 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/index.js +23 -16
- package/lib/cli/index.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -14
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2040,7 +2040,7 @@ interface GetValidateCodeParams {
|
|
|
2040
2040
|
imageWidth?: number;
|
|
2041
2041
|
}
|
|
2042
2042
|
|
|
2043
|
-
type LoginErrorType =
|
|
2043
|
+
type LoginErrorType = "passwordError" | "validateError" | "passwordExpiration" | "SLIDER_VERIFICATION_LOGIN";
|
|
2044
2044
|
declare class BaseLogin {
|
|
2045
2045
|
loginPathname?: string;
|
|
2046
2046
|
BASE: string;
|
package/lib/index.js
CHANGED
|
@@ -929,17 +929,17 @@ function checkCaptchaApi(payload) {
|
|
|
929
929
|
|
|
930
930
|
class BaseLogin {
|
|
931
931
|
loginPathname;
|
|
932
|
-
BASE =
|
|
932
|
+
BASE = "/";
|
|
933
933
|
get baseLoginPathname() {
|
|
934
|
-
return `${this.BASE}${this.loginPathname?.replace(
|
|
934
|
+
return `${this.BASE}${this.loginPathname?.replace("/", "")}`;
|
|
935
935
|
}
|
|
936
|
-
tokenValue =
|
|
936
|
+
tokenValue = "";
|
|
937
937
|
get isLoginPathname() {
|
|
938
938
|
const pathname = window.location.pathname;
|
|
939
939
|
return this.baseLoginPathname == pathname;
|
|
940
940
|
}
|
|
941
941
|
getRealPath = (pathname) => {
|
|
942
|
-
return `${this.BASE}${pathname.replace(
|
|
942
|
+
return `${this.BASE}${pathname.replace("/", "")}`;
|
|
943
943
|
};
|
|
944
944
|
chekToken = async () => {
|
|
945
945
|
const res = await checkTokenApi();
|
|
@@ -956,15 +956,15 @@ class BaseLogin {
|
|
|
956
956
|
if (this.isLoginPathname)
|
|
957
957
|
return true;
|
|
958
958
|
const urlParams = new URLSearchParams();
|
|
959
|
-
if (pathname !== this.BASE)
|
|
960
|
-
urlParams.append(
|
|
959
|
+
if (pathname !== this.BASE && pathname !== "/")
|
|
960
|
+
urlParams.append("redirectUrl", url);
|
|
961
961
|
const searchString = decodeURIComponent(urlParams.toString());
|
|
962
|
-
window.location.replace(`${this.baseLoginPathname}${!!searchString ?
|
|
962
|
+
window.location.replace(`${this.baseLoginPathname}${!!searchString ? "?" + decodeURIComponent(urlParams.toString()) : ""}`);
|
|
963
963
|
return false;
|
|
964
964
|
};
|
|
965
965
|
checkPassword = async () => {
|
|
966
966
|
const res = await checkPasswordApi();
|
|
967
|
-
if (res ===
|
|
967
|
+
if (res === "noPass") {
|
|
968
968
|
// 临时清除token,待修改完密码后恢复
|
|
969
969
|
this.tokenValue = await extractTokenApi();
|
|
970
970
|
return false;
|
|
@@ -993,26 +993,26 @@ class BaseLogin {
|
|
|
993
993
|
result.data = res;
|
|
994
994
|
const checked = await this.checkPassword();
|
|
995
995
|
if (!checked)
|
|
996
|
-
result.error =
|
|
996
|
+
result.error = "passwordExpiration";
|
|
997
997
|
return result;
|
|
998
998
|
}
|
|
999
999
|
//traceId 需要第三方验证 //验证码之后的由业务自行判断
|
|
1000
1000
|
if (traceId) {
|
|
1001
1001
|
result.data = res;
|
|
1002
|
-
result.error =
|
|
1002
|
+
result.error = "SLIDER_VERIFICATION_LOGIN";
|
|
1003
1003
|
return result;
|
|
1004
1004
|
}
|
|
1005
|
-
result.error =
|
|
1005
|
+
result.error = "passwordError";
|
|
1006
1006
|
return result;
|
|
1007
1007
|
}
|
|
1008
1008
|
catch (err) {
|
|
1009
|
-
result.error =
|
|
1009
|
+
result.error = "validateError";
|
|
1010
1010
|
return result;
|
|
1011
1011
|
}
|
|
1012
1012
|
};
|
|
1013
1013
|
loginSuccess = () => {
|
|
1014
1014
|
const params = new URLSearchParams(window.location.search);
|
|
1015
|
-
let url = params.get(
|
|
1015
|
+
let url = params.get("redirectUrl");
|
|
1016
1016
|
if (url)
|
|
1017
1017
|
window.location.href = url;
|
|
1018
1018
|
else
|
|
@@ -1022,7 +1022,7 @@ class BaseLogin {
|
|
|
1022
1022
|
const params = new URLSearchParams();
|
|
1023
1023
|
const url = window.location.href;
|
|
1024
1024
|
if (window.location.pathname !== this.BASE)
|
|
1025
|
-
params.append(
|
|
1025
|
+
params.append("redirectUrl", url);
|
|
1026
1026
|
await accountLogoutApi();
|
|
1027
1027
|
window.location.replace(`${this.baseLoginPathname}?${params.toString()}`);
|
|
1028
1028
|
};
|