Commit f96c71ed authored by 崔佳豪's avatar 崔佳豪

perf: 修改默认密码后退出登录

parent bac69e51
Pipeline #53811 passed with stages
...@@ -3,6 +3,7 @@ import { Modal, message, Form, Input } from 'antd'; ...@@ -3,6 +3,7 @@ import { Modal, message, Form, Input } from 'antd';
import { ExclamationCircleFilled } from '@ant-design/icons'; import { ExclamationCircleFilled } from '@ant-design/icons';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import globalHeader from '@wisdom-utils/components/lib/AppLayout/locales/zh-CN/globalHeader'; import globalHeader from '@wisdom-utils/components/lib/AppLayout/locales/zh-CN/globalHeader';
import { actionCreators } from '@/containers/App/store';
import { appService } from '@/api'; import { appService } from '@/api';
import styles from './index.less'; import styles from './index.less';
const formItemLayout = { const formItemLayout = {
...@@ -19,7 +20,6 @@ const ValidContainer = props => { ...@@ -19,7 +20,6 @@ const ValidContainer = props => {
const [needChangePassword, setNeedChangePassword] = useState(false); const [needChangePassword, setNeedChangePassword] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
console.log('验证是否默认密码')
if (window.location.origin.replace(/^(http|https):\/\//, '') !== 'panda-water.cn') return; if (window.location.origin.replace(/^(http|https):\/\//, '') !== 'panda-water.cn') return;
const { global } = props; const { global } = props;
const tk = global.token; const tk = global.token;
...@@ -51,7 +51,8 @@ const ValidContainer = props => { ...@@ -51,7 +51,8 @@ const ValidContainer = props => {
if (res.success) { if (res.success) {
message.success(globalHeader['component.account.password.update.success']); message.success(globalHeader['component.account.password.update.success']);
setTimeout(() => { setTimeout(() => {
setNeedChangePassword(false); // setNeedChangePassword(false);
props.logout();
}, 300); }, 300);
} else { } else {
message.error(globalHeader['component.account.oldpassword.errorMessage']); message.error(globalHeader['component.account.oldpassword.errorMessage']);
...@@ -131,7 +132,12 @@ const ValidContainer = props => { ...@@ -131,7 +132,12 @@ const ValidContainer = props => {
const mapStateToProps = state => ({ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']), global: state.getIn(['global', 'globalConfig']),
}); });
const mapDispatchToProps = dispatch => ({
logout() {
dispatch(actionCreators.logout());
},
});
export default connect( export default connect(
mapStateToProps, mapStateToProps,
null, mapDispatchToProps,
)(ValidContainer); )(ValidContainer);
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