feat: 登录补上验证码
This commit is contained in:
@@ -58,7 +58,7 @@ public class SysLoginController {
|
||||
/**
|
||||
* TODO: 临时屏蔽回环地址及指定局域网 IP 的平台登录验证码,全部恢复时改为 false。
|
||||
*/
|
||||
private static final boolean DISABLE_LOGIN_CAPTCHA = true;
|
||||
private static final boolean DISABLE_LOGIN_CAPTCHA = false;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="login-form">
|
||||
<div class="my-3 text-6xl font-semibold">${AppName!}${base!}</div>
|
||||
<div class="flx-center-center">
|
||||
<div class="p-12 bg-white rounded-3xl" style="box-sizing: border-box">
|
||||
<div class="p-12 bg-white rounded-3xl" style="box-sizing: border-box; width: 100%">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" auto-complete="on" label-position="left">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
@@ -52,7 +52,7 @@
|
||||
prefix-icon="el-icon-lock"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!captchaDisabled" prop="platformCaptcha">
|
||||
<el-form-item prop="platformCaptcha">
|
||||
<el-input
|
||||
v-model="loginForm.platformCaptcha"
|
||||
auto-complete="off"
|
||||
@@ -124,25 +124,25 @@
|
||||
}
|
||||
</script>
|
||||
<script nonce="${cspNonce!}">
|
||||
// 临时屏蔽指定局域网 IP 的验证码;恢复时删除 192.168.0.108,并同步删除后端对应条件。
|
||||
const DISABLE_LOGIN_CAPTCHA = ["localhost", "127.0.0.1", "::1", "192.168.0.108"].includes(window.location.hostname)
|
||||
|
||||
|
||||
|
||||
new Vue({
|
||||
el: "#app",
|
||||
data() {
|
||||
return {
|
||||
codeUrl: "",
|
||||
captchaDisabled: DISABLE_LOGIN_CAPTCHA,
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
platformKey: "",
|
||||
platformCaptcha: "",
|
||||
grantType: "captcha"
|
||||
},
|
||||
loginRules: {
|
||||
username: [{ required: true, trigger: ["blur", "change"], message: "账号不能为空" }],
|
||||
password: [{ required: true, trigger: ["blur", "change"], message: "密码不能为空" }],
|
||||
platformCaptcha: []
|
||||
platformCaptcha: [{ required: true, trigger: ["blur", "change"], message: "请输入验证码" }]
|
||||
},
|
||||
loading: false,
|
||||
rasParams: {
|
||||
@@ -154,9 +154,6 @@
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
if (this.captchaDisabled) {
|
||||
return
|
||||
}
|
||||
axios.post("/platform/login/captcha").then((resp) => {
|
||||
if (resp.data.code === 0) {
|
||||
this.codeUrl = resp.data.data.codeUrl
|
||||
@@ -325,6 +322,9 @@
|
||||
}
|
||||
|
||||
.login-code img {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
object-fit: contain;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user