mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-08 11:07:34 +08:00
fix: whitelist mode
This commit is contained in:
@@ -8,18 +8,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="email-login-page-content">
|
<div class="email-login-page-content">
|
||||||
<BaseInput
|
<BaseInput icon="fas fa-envelope" v-model="username" placeholder="邮箱/用户名" />
|
||||||
icon="fas fa-envelope"
|
|
||||||
v-model="username"
|
|
||||||
placeholder="邮箱/用户名"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<BaseInput
|
<BaseInput icon="fas fa-lock" v-model="password" type="password" placeholder="密码" />
|
||||||
icon="fas fa-lock"
|
|
||||||
v-model="password"
|
|
||||||
type="password"
|
|
||||||
placeholder="密码"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<div v-if="!isWaitingForLogin" class="login-page-button-primary" @click="submitLogin">
|
<div v-if="!isWaitingForLogin" class="login-page-button-primary" @click="submitLogin">
|
||||||
@@ -78,6 +69,9 @@ export default {
|
|||||||
await loadCurrentUser()
|
await loadCurrentUser()
|
||||||
toast.success('登录成功')
|
toast.success('登录成功')
|
||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
|
} else if (data.reason_code === 'NOT_VERIFIED') {
|
||||||
|
toast.info('当前邮箱未验证,请先重新填写注册页面并验证')
|
||||||
|
this.$router.push('/signup')
|
||||||
} else {
|
} else {
|
||||||
toast.error(data.error || '登录失败')
|
toast.error(data.error || '登录失败')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class AuthController {
|
|||||||
if (captchaEnabled && loginCaptchaEnabled && !captchaService.verify(req.getCaptcha())) {
|
if (captchaEnabled && loginCaptchaEnabled && !captchaService.verify(req.getCaptcha())) {
|
||||||
return ResponseEntity.badRequest().body(Map.of("error", "Invalid captcha"));
|
return ResponseEntity.badRequest().body(Map.of("error", "Invalid captcha"));
|
||||||
}
|
}
|
||||||
Optional<User> userOpt = userService.findByUsername(req.getUsername());
|
Optional<User> userOpt = userService.findByUsername(req.getUsernameOrEmail());
|
||||||
if (userOpt.isEmpty() || !userService.matchesPassword(userOpt.get(), req.getPassword())) {
|
if (userOpt.isEmpty() || !userService.matchesPassword(userOpt.get(), req.getPassword())) {
|
||||||
return ResponseEntity.badRequest().body(Map.of(
|
return ResponseEntity.badRequest().body(Map.of(
|
||||||
"error", "Invalid credentials",
|
"error", "Invalid credentials",
|
||||||
@@ -133,7 +133,7 @@ public class AuthController {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
private static class LoginRequest {
|
private static class LoginRequest {
|
||||||
private String username;
|
private String usernameOrEmail;
|
||||||
private String password;
|
private String password;
|
||||||
private String captcha;
|
private String captcha;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user