mirror of https://github.com/halo-dev/halo
refactor: prevent password field from displaying encrypted text (#6801)
#### What type of PR is this? /area core /kind improvement /milestone 2.20.x #### What this PR does / why we need it: 在提交登录表单时,不在密码框中显示加密文本。 #### Which issue(s) this PR fixes: Fixes #6799 #### Does this PR introduce a user-facing change? ```release-note None ```pull/6806/head
parent
5c50779693
commit
0e4a19d182
|
@ -13,13 +13,15 @@
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const loginForm = document.getElementById("login-form");
|
const loginForm = document.getElementById("login-form");
|
||||||
loginForm.addEventListener("submit", function (event) {
|
loginForm.addEventListener("submit", function (event) {
|
||||||
|
const plainPasswordInput = document.getElementById("plainPassword");
|
||||||
const passwordInput = document.getElementById("password");
|
const passwordInput = document.getElementById("password");
|
||||||
const password = passwordInput.value;
|
passwordInput.value = encryptPassword(plainPasswordInput.value);
|
||||||
passwordInput.value = encryptPassword(password);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<input type="hidden" name="password" id="password" />
|
||||||
|
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<label for="username" th:text="#{form.username.label}"> </label>
|
<label for="username" th:text="#{form.username.label}"> </label>
|
||||||
|
|
||||||
|
@ -50,7 +52,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<th:block
|
<th:block
|
||||||
th:replace="~{gateway_modules/input_fragments :: password(id = 'password', name = 'password', required = 'true', minlength = null, maxlength = 257, enableToggle = true)}"
|
th:replace="~{gateway_modules/input_fragments :: password(id = 'plainPassword', name = null, required = 'true', minlength = null, maxlength = 257, enableToggle = true)}"
|
||||||
></th:block>
|
></th:block>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue