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

fix: 本地存储修改

parent f11f2723
Pipeline #63590 waiting for manual action with stages
......@@ -23,6 +23,7 @@ const ValidContainer = props => {
let rules = localStorage.getItem('password_pwdRegex') ? localStorage.getItem('password_pwdRegex') : '';
const check = localStorage.getItem('password_token');
const rulesTip = localStorage.getItem('password_pwdRegexTip') ? localStorage.getItem('password_pwdRegexTip') : '';
const accessToken = localStorage.getItem('access_token') ? localStorage.getItem('access_token') : '';
let reg;
try {
reg = new RegExp(rules);
......@@ -36,7 +37,7 @@ const ValidContainer = props => {
const tk = global.token;
// eslint-disable-next-line no-eval
if (tk) {
if (check && check === true) {
if (rules !== '' && check && check === accessToken) {
setNeedChangePassword(true);
}
}
......
......@@ -852,9 +852,12 @@ class Login {
rules = '';
reg = new RegExp(rules);
}
const check = rules && rules !== '' && !reg.test(pwd)
localStorage.setItem('access_token', response.access_token);
localStorage.setItem('password_token', check);
let check = false;
if(rules !== '') check = !reg.test(pwd)
localStorage.setItem('access_token', response.access_token ? response.access_token : '');
if(check) {
localStorage.setItem('password_token', response.access_token ? response.access_token : '');
}
Cookies.set('client', self.globalConfig.client, {
expires: exp / (24 * 60 * 60 * 1000),
path: '/',
......
......@@ -123,9 +123,13 @@ export const AppInitState = () => {
}
if (data.pwdRegex) {
localStorage.setItem('password_pwdRegex', data.pwdRegex);
} else {
localStorage.removeItem('password_pwdRegex');
}
if (data.pwdRegexTip) {
localStorage.setItem('password_pwdRegexTip', data.pwdRegexTip);
} else {
localStorage.removeItem('password_pwdRegexTip');
}
store.dispatch(
actionCreators.getConfig(
......
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