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

fix: 免密登录修改

parent 292a96ce
Pipeline #74809 passed with stages
...@@ -137,12 +137,13 @@ class Login { ...@@ -137,12 +137,13 @@ class Login {
}); });
} }
init() { init(site) {
const self = this; const self = this;
this.loginFailed = false; this.loginFailed = false;
this.guid = Math.round(Math.random() * 10000 + Date.now()).toString(16); this.guid = Math.round(Math.random() * 10000 + Date.now()).toString(16);
this.redirect_state = Cookies.get('redirect_state'); this.redirect_state = Cookies.get('redirect_state');
const token = this.globalConfig.initToken || Cookies.get('token') || params.getParams('token'); const token = this.globalConfig.initToken || Cookies.get('token') || params.getParams('token');
const noTokenSite = site ?? null;
let { ddCode } = this.globalConfig; let { ddCode } = this.globalConfig;
let { loginName } = this.globalConfig; let { loginName } = this.globalConfig;
let { password } = this.globalConfig; let { password } = this.globalConfig;
...@@ -170,7 +171,7 @@ class Login { ...@@ -170,7 +171,7 @@ class Login {
if (loginMode && loginMode === 'iotWechat') ddCode = null; if (loginMode && loginMode === 'iotWechat') ddCode = null;
// self.qrcodeLogin(self.globalConfig.qrcodeData.code); // self.qrcodeLogin(self.globalConfig.qrcodeData.code);
if (token) { if (token) {
self.getToweb(token); self.getToweb(token, noTokenSite);
// eslint-disable-next-line no-empty // eslint-disable-next-line no-empty
} else if (ddCode && loginMode === 'dingding') { } else if (ddCode && loginMode === 'dingding') {
self.ddLoginIn(ddCode); self.ddLoginIn(ddCode);
...@@ -192,14 +193,14 @@ class Login { ...@@ -192,14 +193,14 @@ class Login {
} }
} }
getToweb(token) { getToweb(token, noTokenSite) {
this.globalConfig.token = token; this.globalConfig.token = token;
const self = this; const self = this;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
getUserInfo({ getUserInfo({
token: this.globalConfig.token, token: this.globalConfig.token,
subOID: 'subOID', subOID: 'subOID',
site: this.getLocalSiteBytoken(token), site: noTokenSite ?? this.getLocalSiteBytoken(token),
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
ignoreSite: true, ignoreSite: true,
}) })
......
...@@ -23,8 +23,8 @@ const Login = forwardRef((props, _ref) => { ...@@ -23,8 +23,8 @@ const Login = forwardRef((props, _ref) => {
const param = params.getParams('token')?.replaceAll(';', '&'); const param = params.getParams('token')?.replaceAll(';', '&');
return param ? decodeURIComponent(escape(param)) : null; return param ? decodeURIComponent(escape(param)) : null;
}); });
const [authCode] = useState(() => { const [site] = useState(() => {
const param = params.getParams('authCode')?.replaceAll(';', '&'); const param = params.getParams('site')?.replaceAll(';', '&');
return param ? decodeURIComponent(escape(param)) : null; return param ? decodeURIComponent(escape(param)) : null;
}); });
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱 // 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
...@@ -70,7 +70,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -70,7 +70,7 @@ const Login = forwardRef((props, _ref) => {
action.transformLoginHander(res, false); action.transformLoginHander(res, false);
}); });
} else { } else {
action.init(); action.init(site);
} }
} }
}, [action, action.globalConfig, props.global]); }, [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