login.ejs 2.28 KB
<% include ../includes/header.ejs %>
<div class="row">
    <div class="col-md-4 col-md-offset-4">
        <%if(typeof flashMessage !=='undefined') {%>
            <div class="alert alert-danger" role="alert"><%=flashMessage%></div>
        <%}%>
        <div class="login-panel panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">로그인</h3>
            </div>
            <div class="panel-body">
                <form role="form" action="" id="login_form" method="post">
                    <fieldset>
                        <div class="form-group">
                            <input class="form-control" placeholder="ID" name="username" type="text" autofocus="" required="">
                        </div>
                        <div class="form-group">
                            <input class="form-control" placeholder="Password" name="password" type="password" value="" required="">
                        </div>
                        <!-- Change this to a button or input when using this as a form -->
                        <input type="submit" class="btn btn-lg btn-success btn-block" value="로그인">
                        <div style="margin-top: 10px">
                            <a href="/auth/facebook" class="btn btn-lg btn-primary btn-block">
                                <i class="fa fa-facebook" aria-hidden="true"></i> 페이스북 로그인
                            </a>
                        </div>
                    </fieldset>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
(function(){
    $(document).ready(function() {
        $('#login_form').submit(function(){
            var $usernameInput = $('#login_form input[name=username]');
            var $passwordInput = $('#login_form input[name=password]');
            if(!$usernameInput.val()){
                alert("아이디를 입력해주세요.");
                $usernameInput.focus();
                return false;
            }
            if(!$passwordInput.val()){
                alert("패스워드를 입력해주세요.");
                $passwordInput.focus();
                return false;
            }
            return true;
        });
    });
})();
</script>
<% include ../includes/footer.ejs %>