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