<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head th:replace="fragment :: head(~{::title})">
    <title>修改密码</title>
    <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
</head>

<body class="login-bg">

<br>
<br>
<br>
<div class="m-container-small m-padded-tb-massive disabled" style="max-width: 30em !important;">
    <div class="ur container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui teal image header">
                    <div class="content" >
                       修改密码
                    </div>
                </h2>
                <form class="ui large form" method="post" action="#" th:action="@{/user/toUpdate}">
                    <div class="ui  segment">
                        <div class="field" hidden>
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="用户名" th:value="${session.user.getUsername()}">
                            </div>
                        </div>

                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="oldPassword"  th:value="${session.user.getPassword()}" >
                            </div>
                        </div>
                        <br><br><br>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="newPassword"   placeholder="请输入新密码">
                            </div>
                        </div>
                        <br><br><br>
                        <button class="ui fluid large teal submit button" >修改</button>

                    </div>


                    <div id="errorMessage" style="display: none" th:text="${msg}">信息有误！！</div>

                </form>

            </div>
        </div>
    </div>
</div>


<script>
    $('.ui.form').form({
        fields : {
            newPassword : {
                identifier: 'newPassword',
                rules: [{
                    type : 'empty',
                    prompt: '新密码不能为空！'
                }]
            },

        }
    });

    $(document).ready(function(){


        if ( $('#errorMessage').text()!='')
        {
            alert("客官，您输入的信息可能有误哦！")
        }else
        {

        }


    })


</script>

</body>
</html>
