Files
korea-research/front/src/main/resources/templates/security/login.html
2025-06-17 11:54:32 +09:00

109 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html layout:decorate="~{layout/layout-login}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<div layout:fragment="content">
<form method="post" th:action="@{/login}" name="loginForm">
<main id="content" role="main">
<div class="inner">
<hgroup class="login-tit-group">
<span>2025</span>
<h3>
임가경제조사 일계부
</h3>
</hgroup>
<div class="login-form-group">
<div class="component-input">
<div class="input-label">
<label for="floatingInput" class="label-txt">
임가번호
</label>
</div>
<div class="input-field">
<input autofocus class="" id="floatingInput" name="username" placeholder="임가번호를 입력해 주세요" value="11111"
type="number" maxlength="5">
</div>
<ul class="input-info" id="username-error" style="display: none;">
<li>임가번호를 입력해주세요</li>
</ul>
</div>
<div class="component-input" data-props-toggle-Password="true">
<div class="input-label">
<label for="floatingPassword" class="label-txt">
비밀번호
</label>
</div>
<div class="input-field">
<input type="password" name="password" id="floatingPassword" placeholder="비밀번호 4자리를 입력해 주세요" value="1111" maxlength="4">
</div>
<ul class="input-info" id="password-error" style="display: none;">
<li>비밀번호를 입력해주세요</li>
</ul>
</div>
<div class="component-input" roleDto="group" aria-label="Basic checkbox toggle button group">
<label for="btn_ck1" class="checkbox-inner">
<input autocomplete="off" type="checkbox" id="btn_ck1" name="remember-me">
<span class="checkbox-item">
<span class="checkbox-txt">로그인 상태 유지</span>
</span>
</label>
</div>
<button type="submit" class="btn btn-m btn-primary btn-full">
<span class="btn-txt">로그인</span>
</button>
</div>
</div>
</main>
</form>
</div>
<th:block layout:fragment="script">
<script th:inline="javascript">
document.addEventListener('DOMContentLoaded', function() {
const errorMessage = /*[[${session['SPRING_SECURITY_LAST_EXCEPTION']?.message}]]*/ null;
if (errorMessage) {
etUI.dialog.alert({
message: "입력하신 정보가 맞지 않습니다.\n 다시 확인해주세요.",
type: "alert",
callback: function () {
document.loginForm.reset();
}
});
}
});
document.getElementById('floatingPassword').addEventListener('focusout', function() {
const passwordInput = this;
const passwordValue = passwordInput.value;
const errorContainer = document.getElementById('password-error');
const parentComponent = passwordInput.closest('.component-input');
if (passwordValue.length < 4) {
parentComponent.classList.add('input-invalid');
errorContainer.style.display = 'block';
} else {
parentComponent.classList.remove('input-invalid');
errorContainer.style.display = 'none';
}
});
document.getElementById('floatingInput').addEventListener('focusout', function() {
const floatingInput = this;
const userNameValue = floatingInput.value;
const errorContainer = document.getElementById('username-error');
const parentComponent = floatingInput.closest('.component-input');
if (userNameValue.length < 5) {
parentComponent.classList.add('input-invalid');
errorContainer.style.display = 'block';
} else {
parentComponent.classList.remove('input-invalid');
errorContainer.style.display = 'none';
}
});
</script>
</th:block>
</html>