<!doctype html>
<html lang="ko"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{kr/iotdoor/comn/site/layout/mngLoginLayout.html}" >

<head>
    <title>Login</title>
</head>
<body>

<th:block layout:fragment="content">
    <section class="login-container">

        <div class="login-box">
            <h2 class="login-ico">
                <!-- <img th:src="@{/resources/kr/iotdoor/comn/site/layout/image/common/logo.svg}" alt="국제오토텍"/> -->
                ADMIN
            </h2>
            <th:block sec:authorize="isAnonymous()">
                <form name="loginForm" method="post" th:action="@{/comn/user/login/actionLogin.do}">
                    <fieldset>
                        <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
                        <input type="hidden" name="returnUrl" th:value="${returnUrl}"/>
                        <input type="hidden" id="loginMessage" name="loginMessage" th:value="${loginMessage}">
                    </fieldset>
                    <fieldset class="login-form">
                        <legend class="visually-hidden">관리자용 로그인 양식</legend>
                        <div>
                            <div class="login-field pt-0">
                                <label for="userId" class="visually-hidden">관리자용 아이디</label>
                                <i class="bi bi-person-fill"></i>
                                <input type="text" id="userId" name="id" placeholder="관리자용 아이디" autocomplete="username" required/>
                            </div>
                            <div class="login-field">
                                <label for="userPassword" class="visually-hidden">관리자용 비밀번호</label>
                                <i class="bi bi-lock-fill"></i>
                                <input type="password" id="userPassword" name="password" placeholder="관리자용 비밀번호" autocomplete="current-password" required/>
                            </div>
                        </div>
                        <button type="submit">관리자 로그인</button>
                    </fieldset>
                </form>
            </th:block>
            <th:block sec:authorize="isAuthenticated()">
                <a href="/">GO HOME</a>
            </th:block>
        </div>
    </section>
</th:block>
<th:block layout:fragment="script">
<script>
    $(document).ready(function (){
        const loginMessage = $('#loginMessage').val();
        if(loginMessage && loginMessage.length !== 0){
            bootboxAlert({title:'확인',size:'small',message:loginMessage});
        }
    });
</script>
</th:block>
</body>
</html>
