join.ejs 3.5 KB
<% include ../includes/header.ejs %>
<div class="w-25 border border-info border-3" style="position: absolute; left: 37%; top: 17%;">
    <div>
        <div>
            <div style="padding-top: 5%; padding-left: 5%;">
                <h3 class="panel-title">회원가입</h3>
            </div>
            <div class="panel-body">
                <form role="form" action="" id="join_form" method="post">
                    <fieldset>
                        <div class="w-100" style="padding-left: 5%; padding-right: 5%;">
                            <input class="form-control" placeholder="ID" name="username" type="text" autofocus="" required="">
                        </div>
                        <div class="w-100" style="padding-left: 5%; padding-right: 5%;padding-top: 3%">
                            <input class="form-control" placeholder="Password" name="password" type="password" value="" required="">
                        </div>
                        <div class="w-100" style="padding-left: 5%; padding-right: 5%;padding-top: 3%">
                            <input class="form-control" placeholder="Password 확인" name="password2" type="password" value="" required="">
                        </div>
                        <div class="w-100" style="padding-left: 5%; padding-right: 5%;padding-top: 3%">
                            <input class="form-control" placeholder="이름" name="displayname" type="text" value="" required="">
                        </div>
                        <!-- Change this to a button or input when using this as a form -->
                        <div class="d-grid gap-2 col-11 mx-auto p-2">
                        <input type="submit" class="btn btn-lg btn-success btn-block" value="가입하기">
                            <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() {
        $('#join_form').submit(function(){
            var $usernameInput = $('#join_form input[name=username]');
            var $passwordInput = $('#join_form input[name=password]');
            var $passwordInput2 = $('#join_form input[name=password2]');
            var $displayname = $('#join_form input[name=displayname]');
            if(!$usernameInput.val()){
                alert("아이디를 입력해주세요.");
                $usernameInput.focus();
                return false;
            }
            if(!$passwordInput.val()){
                alert("패스워드를 입력해주세요.");
                $passwordInput.focus();
                return false;
            }
            if(!$passwordInput2.val()){
                alert("확인 패스워드를 입력해주세요.");
                $passwordInput2.focus();
                return false;
            }
            if(!$displayname.val()){
                alert("이름을 입력해주세요.");
                $displayname.focus();
                return false;
            }
            if($passwordInput.val() !== $passwordInput2.val()){
                alert("패스워드와 확인용패스워드를 똑같이 입력해주세요.");
                return false;
            }
            return true;
        });
    });
})();
</script>
<% include ../includes/footer.ejs %>