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

fix: 本地存储修改

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