Commit ee2d6795 authored by 李纪文's avatar 李纪文

feat: noSecret增加和达免登

parent eb43fc49
Pipeline #90924 passed with stages
......@@ -22,6 +22,7 @@ export const API = {
CHANGE_PASSWORD: 'cityinterface/rest/services.svc/changepassword',
CHANGE_PASSWORD_SAFE: '/PandaOMS/OMS/UserCenter/UpdateUserPassword',
HD_AUTH_LOGIN: '/PandaCore/GCK/BussinessAuth/HDAuthLogin',
AUTH_HDU_SER: '/PandaWater/CityWater/SJZGX/AuthHDUSer',
IOT_CHANGE_PASSWORD: 'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK',
FILE_DOWNLOAD: '/cityinterface/rest/services/filedownload.svc/download',
UPDATE_AVATAR: '/CityInterface/rest/services/OMs.svc/U_EditUser',
......@@ -89,6 +90,11 @@ const services = {
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
AuthHDUSer: {
url: API.AUTH_HDU_SER,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
authorizationToken: {
url: API.AUTHORIZATION_TOKEN,
method: constants.REQUEST_METHOD_GET,
......
......@@ -36,7 +36,13 @@ const Login = forwardRef((props, _ref) => {
});
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
const hasLogin = useRef();
useEffect(() => {
const getAuthDataInfo = async () => {
const value = params.getParams('uniwater_utoken');
const hdtoken = value && value !== 'undefined' ? value : null;
const authRes = hdtoken ? await appService.AuthHDUSer({ token: hdtoken, ignoreSite: true }) : '';
return authRes?.data || '';
};
useEffect(async () => {
action.globalConfig = props.global;
// eslint-disable-next-line no-prototype-builtins
if (
......@@ -47,11 +53,12 @@ const Login = forwardRef((props, _ref) => {
) {
hasLogin.current = true;
window.hasLogin = true;
const authData = !token ? await getAuthDataInfo() : '';
const isGZproject = window.globalConfig.subtitle === '广州节约用水管理系统';
if (window.globalConfig && window.globalConfig.hasGateWay && !isGZproject) {
appService
.authorizationToken({
loginName: token,
loginName: token || authData,
type: 'token',
generateType: params.getParams('generateType') || '',
})
......
......@@ -63,9 +63,15 @@ export const AppInitState = () => {
const token = value && value !== 'undefined' ? value : null;
return token;
};
const getHDToken = () => {
const value = params.getParams('uniwater_utoken');
const hdtoken = value && value !== 'undefined' ? value : null;
return hdtoken;
};
const client = getClient();
const token = getUrlToken();
const HDtoken = getHDToken();
if (sessionStorage.getItem('client') !== client) {
sessionStorage.setItem('client', client);
}
......@@ -174,7 +180,7 @@ export const AppInitState = () => {
}
// eslint-disable-next-line no-new
// 增加免登判定
if (!token && getToken()) {
if (!token && !HDtoken && getToken()) {
// eslint-disable-next-line no-new
const action = new Login(
{
......
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