mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
#IBY0OL 长时间未操作,验证码无法登录
This commit is contained in:
parent
5662647573
commit
ca2832d4e2
@ -78,10 +78,11 @@ public class ImageCaptchaEndpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String kaptchaKey = "";
|
String kaptchaKey = "";
|
||||||
if(StringUtils.isNotBlank(state)
|
if(StringUtils.isNotBlank(state) && !state.equalsIgnoreCase("state")) {
|
||||||
&& !state.equalsIgnoreCase("state")
|
|
||||||
&& authTokenService.validateJwtToken(state)) {
|
|
||||||
//just validate state Token
|
//just validate state Token
|
||||||
|
if(!authTokenService.validateJwtToken(state)) {
|
||||||
|
return new Message<>(Message.FAIL,"JwtToken is not Validate ");
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
state = authTokenService.genRandomJwt();
|
state = authTokenService.genRandomJwt();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,10 +140,7 @@ export class UserLoginComponent implements OnInit, OnDestroy {
|
|||||||
this.form.get('captcha')?.clearValidators();
|
this.form.get('captcha')?.clearValidators();
|
||||||
} else {
|
} else {
|
||||||
//init image captcha
|
//init image captcha
|
||||||
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
this.getImageCaptcha();
|
||||||
this.imageCaptcha = res.data.image;
|
|
||||||
this.cdr.detectChanges();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,8 +203,13 @@ export class UserLoginComponent implements OnInit, OnDestroy {
|
|||||||
// #region get captcha
|
// #region get captcha
|
||||||
getImageCaptcha(): void {
|
getImageCaptcha(): void {
|
||||||
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
||||||
|
if (res.code == 0) {
|
||||||
this.imageCaptcha = res.data.image;
|
this.imageCaptcha = res.data.image;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
|
} else {
|
||||||
|
//令牌失效时,重新刷新页面
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,10 +99,7 @@ export class UserLoginComponent implements OnInit, OnDestroy {
|
|||||||
this.state = res.data.state;
|
this.state = res.data.state;
|
||||||
this.captchaType = res.data.captcha;
|
this.captchaType = res.data.captcha;
|
||||||
//init image captcha
|
//init image captcha
|
||||||
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
this.getImageCaptcha();
|
||||||
this.imageCaptcha = res.data.image;
|
|
||||||
this.cdr.detectChanges();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -113,8 +110,13 @@ export class UserLoginComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
getImageCaptcha(): void {
|
getImageCaptcha(): void {
|
||||||
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
this.imageCaptcha = res.data.image;
|
this.imageCaptcha = res.data.image;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
|
} else {
|
||||||
|
//令牌失效时,重新刷新页面
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user