| | |
| | | import React, { Component } from 'react' |
| | | import { message, Modal } from 'antd' |
| | | import { message, Modal, notification } from 'antd' |
| | | import { connect } from 'react-redux' |
| | | import md5 from 'md5' |
| | | import moment from 'moment' |
| | |
| | | import options, { styles } from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/login.js' |
| | | import enUS from '@/locales/en-US/login.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncLoadComponent from '@/utils/asyncLoadComponent' |
| | | import { modifyMemberLevel } from '@/store/action' |
| | | import './index.scss' |
| | | |
| | | const LoginForm = asyncLoadComponent(() => import('./loginform')) |
| | | const LoginCloudForm = asyncLoadComponent(() => import('./logincloudform')) |
| | | const Resetpwd = asyncLoadComponent(() => import('@/components/header/resetpwd')) |
| | | const LoginCloudForm = asyncComponent(() => import('./logincloudform')) |
| | | const iszhCN = sessionStorage.getItem('lang') !== 'en-US' |
| | | |
| | | const _href = window.location.href.split('#')[0] |
| | |
| | | loginWays: null, |
| | | touristLogin: false, |
| | | syncing: false, |
| | | visible: false |
| | | visible: false, |
| | | resetLoading: false |
| | | } |
| | | |
| | | changelang (item) { |
| | |
| | | localStorage.removeItem(_url) |
| | | } |
| | | |
| | | // let level = localStorage.getItem(_url + 'pwdlevel') |
| | | let level = localStorage.getItem(_url + 'pwdlevel') |
| | | |
| | | // if (level) { |
| | | // let visible = false |
| | | // let tip = '密码强度不够,请修改密码!' |
| | | // if (param.password.length < 8) { |
| | | // visible = true |
| | | // } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(param.password)) { |
| | | // visible = true |
| | | // } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(param.password)) { |
| | | // visible = true |
| | | // } else if (level === 'char_num_90' && res.modifydate) { |
| | | // let s = (new Date().getTime() - new Date(res.modifydate).getTime()) / (1000 * 24 * 60 * 60) |
| | | // if (!isNaN(s) && s > 90) { |
| | | // visible = true |
| | | // tip = '您已90天未修改密码,请更换密码后使用!' |
| | | // } |
| | | // } |
| | | if (level) { |
| | | let visible = false |
| | | let tip = '密码强度不够,请修改密码!' |
| | | if (param.password.length < 8) { |
| | | visible = true |
| | | } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(param.password)) { |
| | | visible = true |
| | | } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(param.password)) { |
| | | visible = true |
| | | } else if (level === 'char_num_90' && res.modifydate) { |
| | | let s = (new Date().getTime() - new Date(res.modifydate).getTime()) / (1000 * 24 * 60 * 60) |
| | | if (!isNaN(s) && s > 90) { |
| | | visible = true |
| | | tip = '您已90天未修改密码,请更换密码后使用!' |
| | | } |
| | | } |
| | | |
| | | // if (visible) { |
| | | // message.warning(tip) |
| | | // this.setState({ |
| | | // isDisabled: false, |
| | | // visible: true |
| | | // }) |
| | | // return |
| | | // } |
| | | // } |
| | | if (visible) { |
| | | message.warning(tip) |
| | | this.setState({ |
| | | isDisabled: false, |
| | | visible: true |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | |
| | | app_version: res.app_version |
| | | } |
| | | |
| | | let level = res.pwd_level || 'char_num_90' |
| | | let level = res.pwd_level || '' |
| | | |
| | | if (level && !['letter_num', 'char_num', 'char_num_90'].includes(level)) { |
| | | level = '' |
| | |
| | | param.rduri = options.cloudServiceApi.replace('dostars', 'dostar') |
| | | } |
| | | |
| | | |
| | | this.logincloudRef.handleConfirm().then(result => { |
| | | param.UserName = result.cloudusername |
| | | param.Password = result.cloudpassword |
| | |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | resetPwdSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | resetLoading: true |
| | | }) |
| | | |
| | | let _param = { |
| | | func: 's_PwdUpt', |
| | | LText: `select '${res.originpwd}','${res.password}'` |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 时间戳 |
| | | _param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | this.setState({ |
| | | visible: !result.status, |
| | | resetLoading: false |
| | | }) |
| | | |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '修改成功,请重新登录。', |
| | | duration: 2 |
| | | }) |
| | | const input = document.getElementById('password') |
| | | if (input) { |
| | | input.select() |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }, () => {}) |
| | | } |
| | | |
| | | /** |
| | |
| | | > |
| | | <LoginCloudForm handleSubmit={() => this.syncSubmit()} wrappedComponentRef={(inst) => this.logincloudRef = inst}/> |
| | | </Modal> |
| | | {/* 修改密码 */} |
| | | <Modal |
| | | title="修改密码" |
| | | okText={this.state.dict['login.ok']} |
| | | cancelText={this.state.dict['login.cancel']} |
| | | visible={this.state.visible} |
| | | onOk={this.resetPwdSubmit} |
| | | confirmLoading={this.state.resetLoading} |
| | | onCancel={() => this.setState({visible: false, resetLoading: false})} |
| | | destroyOnClose |
| | | > |
| | | <Resetpwd wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |