Commit e62762fc authored by 杨思琦's avatar 杨思琦

fix: 免密登录修改

parent 292a96ce
Pipeline #74809 passed with stages
......@@ -133,16 +133,17 @@ class Login {
getIpone() {
const self = this;
return appService.getUserMobile({
// isTest: true,
// isTest: true,
});
}
init() {
init(site) {
const self = this;
this.loginFailed = false;
this.guid = Math.round(Math.random() * 10000 + Date.now()).toString(16);
this.redirect_state = Cookies.get('redirect_state');
const token = this.globalConfig.initToken || Cookies.get('token') || params.getParams('token');
const noTokenSite = site ?? null;
let { ddCode } = this.globalConfig;
let { loginName } = this.globalConfig;
let { password } = this.globalConfig;
......@@ -170,7 +171,7 @@ class Login {
if (loginMode && loginMode === 'iotWechat') ddCode = null;
// self.qrcodeLogin(self.globalConfig.qrcodeData.code);
if (token) {
self.getToweb(token);
self.getToweb(token, noTokenSite);
// eslint-disable-next-line no-empty
} else if (ddCode && loginMode === 'dingding') {
self.ddLoginIn(ddCode);
......@@ -192,14 +193,14 @@ class Login {
}
}
getToweb(token) {
getToweb(token, noTokenSite) {
this.globalConfig.token = token;
const self = this;
// eslint-disable-next-line no-undef
getUserInfo({
token: this.globalConfig.token,
subOID: 'subOID',
site: this.getLocalSiteBytoken(token),
site: noTokenSite ?? this.getLocalSiteBytoken(token),
'request.preventCache': Date.now(),
ignoreSite: true,
})
......
......@@ -23,8 +23,8 @@ const Login = forwardRef((props, _ref) => {
const param = params.getParams('token')?.replaceAll(';', '&');
return param ? decodeURIComponent(escape(param)) : null;
});
const [authCode] = useState(() => {
const param = params.getParams('authCode')?.replaceAll(';', '&');
const [site] = useState(() => {
const param = params.getParams('site')?.replaceAll(';', '&');
return param ? decodeURIComponent(escape(param)) : null;
});
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
......@@ -70,7 +70,7 @@ const Login = forwardRef((props, _ref) => {
action.transformLoginHander(res, false);
});
} else {
action.init();
action.init(site);
}
}
}, [action, action.globalConfig, props.global]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment