You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.9 KiB

{% extends 'base.html' %}
{% block content %}
<div id="tab-2" class="tab-pane">
<div class="panel-body">
<form class="form-horizontal m-t" id="pwdForm" style="width:600px">
<div class="form-group">
<label class="col-sm-3 control-label">请输入新密码:</label>
<div class="col-sm-8">
<input type="hidden" name="user_id" value="{{ user_id }}">
<input id="NewPwd" name="NewPwd" class="form-control" required type="password">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认密码:</label>
<div class="col-sm-8">
<input id="NewPwd1" name="NewPwd1" class="form-control" required type="password">
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
</div>
</div>
<div class="form-group" style="margin-top:35px">
<div class="col-sm-8 col-sm-offset-3">
<button class="btn btn-primary" type="submit">提交</button>
</div>
</div>
</form>
</div>
</div>
<script>
$(function () {
var index = parent.layer.getFrameIndex(window.name);
$("#pwdForm").submit(function () {
if ($("#NewPwd").val() != $("#NewPwd1").val()) {
msg("确认密码与新密码不一致!");
return false;
}
var loadIndex = layer.load(2);
$.post("{% url 'home:saveMyPwd' %}", $(this).serialize(), function (obj) {
layer.close(loadIndex);
if (obj.status == 1) {
if (obj.data == '{{ request.session.login_user.UserId }}'){
msg('保存成功', function () {
window.parent.location.href = '{% url "account_login" %}'
})
}else{
msg('保存成功', function () {
parent.layer.close(index);
});
}
}
else {
msg(obj.message);
}
});
return false;
})
})
</script>
{% endblock %}