123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- {{template "header.tmpl" .}}
- </head>
- <body>
- {{template "navbar.tmpl" .}}
- <div class="container-fluid">
- <form class="center-block" id="mainform" style="width:400px;">
- <div class="form-group">
- <label>ID</label>
- <input type="text" class="form-control" name="" value="{{.Sess.Account.Id}}" maxlength="20" readonly="readonly" />
- </div>
- <div class="form-group">
- <label>用户名</label>
- <input type="text" class="form-control" name="" value="{{.Sess.Account.Account}}" maxlength="20" readonly="readonly" />
- </div>
- <div class="form-group">
- <label>旧密码</label>
- <input type="password" class="form-control" name="oldpwd" value="" maxlength="20" />
- </div>
- <div class="form-group">
- <label>新密码(6位以上)</label>
- <input type="password" class="form-control" name="newpwd" value="" maxlength="20" />
- </div>
- <div class="form-group">
- <label>重复新密码</label>
- <input type="password" class="form-control" name="newpwd2" value="" maxlength="20" />
- </div>
- <button class="btn btn-primary">提交</button>
- </form>
- </div>
- <script type="text/javascript">
- var $SESS = {{.Sess}};
- $(function(){
- $('#mainform').submit(function(){
- if (this.oldpwd.value == '') {
- $.alert({'content': '旧密码不能为空!'});
- } else if (this.oldpwd.value.length < 6) {
- $.alert({'content': '旧密码格式不正确!'});
- } else if (this.newpwd.value == '') {
- $.alert({'content': '新密码不能为空!'});
- } else if (this.newpwd.value.length < 6) {
- $.alert({'content': '新密码格式不正确!'});
- } else if (this.newpwd2.value != this.newpwd.value) {
- $.alert({'content': '新密码两次输入不一致!'});
- } else {
- $.post('/profile/passwd', $(this).serialize(), function(resp){
- if (resp.errno) {
- $.alert({'content': resp.error});
- } else {
- $.alert({'content': '修改成功!'});
- }
- }, 'json');
- }
- return false;
- });
- });
- </script>
- </body>
- </html>
|