8.15 登录过程中用户信息错误导致登录失败的业务处理
This commit is contained in:
@ -68,10 +68,10 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
const header = {
|
||||
clientId: REACT_APP_CLIENT_KEY,
|
||||
}
|
||||
await refreshTokenApi(params,header).then(res => {
|
||||
if(res?.success == true) {
|
||||
await refreshTokenApi(params, header).then(res => {
|
||||
if (res?.success == true) {
|
||||
sessionStorage.setItem('Authorization', res?.data?.value);
|
||||
sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
sessionStorage.setItem('scope', res?.data?.scope);
|
||||
history.push('/redirect');
|
||||
}
|
||||
@ -79,21 +79,21 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
}
|
||||
|
||||
const handleSubmit = async (values: any) => {
|
||||
if(START_ENV == 'sim' || START_ENV == 'PROD'){
|
||||
if (START_ENV == 'sim' || START_ENV == 'PROD') {
|
||||
let code = {
|
||||
code: values.userCode
|
||||
}
|
||||
await getPassword ({...code}).then((res) => {
|
||||
await getPassword({ ...code }).then((res) => {
|
||||
if (res?.data) {
|
||||
|
||||
|
||||
disSet(true);
|
||||
ZjfakeAccountLogin({ ...values, tmpToken }).then((res) => {
|
||||
if (res?.success) {
|
||||
if(moment(res?.data?.expiration).diff(moment(),'hours') < remainingTime) {
|
||||
if (moment(res?.data?.expiration).diff(moment(), 'hours') < remainingTime) {
|
||||
refreshToken(res?.data)
|
||||
} else {
|
||||
sessionStorage.setItem('Authorization', res?.data?.value);
|
||||
sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
sessionStorage.setItem('scope', res?.data?.scope);
|
||||
history.push('/redirect');
|
||||
}
|
||||
@ -101,7 +101,7 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
changeCaptcha();
|
||||
disSet(false);
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
message.error('口令不正确,请重新输入')
|
||||
}
|
||||
@ -110,11 +110,11 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
disSet(true);
|
||||
await ZjfakeAccountLogin({ ...values, tmpToken }).then((res) => {
|
||||
if (res?.success) {
|
||||
if(moment(res?.data?.expiration).diff(moment(),'hours') < remainingTime) {
|
||||
if (moment(res?.data?.expiration).diff(moment(), 'hours') < remainingTime) {
|
||||
refreshToken(res?.data)
|
||||
} else {
|
||||
sessionStorage.setItem('Authorization', res?.data?.value);
|
||||
sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
sessionStorage.setItem('scope', res?.data?.scope);
|
||||
history.push('/redirect');
|
||||
}
|
||||
@ -141,14 +141,14 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
<LoginMessage content="账号或密码错误" />
|
||||
)}
|
||||
{
|
||||
START_ENV == 'sim' || START_ENV == 'PROD' ?
|
||||
<Row>
|
||||
<Col span={24}>
|
||||
<Form.Item name="userCode" rules={[{ required: true, message: '请输入口令' }]}>
|
||||
<Input size='large' placeholder="请输入口令" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row> : null
|
||||
START_ENV == 'sim' || START_ENV == 'PROD' ?
|
||||
<Row>
|
||||
<Col span={24}>
|
||||
<Form.Item name="userCode" rules={[{ required: true, message: '请输入口令' }]}>
|
||||
<Input size='large' placeholder="请输入口令" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row> : null
|
||||
}
|
||||
<UserName
|
||||
name="userName"
|
||||
@ -177,8 +177,8 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
<Input size='large' placeholder="验证码" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12} style={{lineHeight: '33.11px'}}>
|
||||
<Image src={imgUrl} preview={false} onClick={() => changeCaptcha()}/>
|
||||
<Col span={12} style={{ lineHeight: '33.11px' }}>
|
||||
<Image src={imgUrl} preview={false} onClick={() => changeCaptcha()} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Submit loading={submitting} disabled={dis}>
|
||||
|
Reference in New Issue
Block a user