Commit abf52034 by fengshuonan

完善修改密码页面

parent ce5dc8a1
......@@ -167,15 +167,15 @@ public class UserMgrController extends BaseController {
*/
@RequestMapping("/changePwd")
@ResponseBody
public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) {
if (!newPwd.equals(rePwd)) {
throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH);
public Object changePwd(@RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
if (ToolUtil.isOneEmpty(oldPassword, newPassword)) {
throw new RequestEmptyException();
}
Integer userId = ShiroKit.getUser().getId();
User user = userService.selectById(userId);
String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt());
String oldMd5 = ShiroKit.md5(oldPassword, user.getSalt());
if (user.getPassword().equals(oldMd5)) {
String newMd5 = ShiroKit.md5(newPwd, user.getSalt());
String newMd5 = ShiroKit.md5(newPassword, user.getSalt());
user.setPassword(newMd5);
user.updateById();
return SUCCESS_TIP;
......
......@@ -128,6 +128,9 @@
<!--Custom JavaScript -->
<script src="${ctxPath}/assets/common/static/js/custom.min.js"></script>
<!-- vue -->
<script src="${ctxPath}/assets/common/plugins/vue/vue.js"></script>
<!-- 右侧主题设置 -->
<script src="${ctxPath}/assets/common/plugins/styleswitcher/jQuery.style.switcher.js"></script>
......
......@@ -36,8 +36,8 @@
<button class="btn btn-info" type="button" id="saveButton" \@click="ensure">
<i class="ace-icon fa fa-check"></i> 保存
</button>
<button class="btn btn-danger m-l-10" type="button" id="closeButton" \@clic="reset">
<i class="ace-icon fa fa-close"></i> 关闭
<button class="btn btn-danger m-l-10" type="button" id="closeButton" \@click="reset">
<i class="ace-icon fa fa-close"></i> 重置
</button>
</div>
</div>
......
(function () {
var $ax = function (url, success, error) {
this.url = url;
this.type = "post";
this.data = {};
this.dataType = "json";
this.async = false;
this.success = success;
this.error = error;
};
$ax.prototype = {
start : function () {
var me = this;
if (this.url.indexOf("?") == -1) {
this.url = this.url + "?jstime=" + new Date().getTime();
} else {
this.url = this.url + "&jstime=" + new Date().getTime();
}
$.ajax({
type: this.type,
url: this.url,
dataType: this.dataType,
async: this.async,
data: this.data,
beforeSend: function(data) {
},
success: function(data) {
me.success(data);
},
error: function(data) {
me.error(data);
}
});
},
set : function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
setData : function(data){
this.data = data;
return this;
},
clear : function () {
this.data = {};
return this;
}
};
window.$ax = $ax;
} ());
\ No newline at end of file
......@@ -36,8 +36,8 @@
}
},
error: function (data) {
if (me.success !== undefined) {
me.success(data);
if (me.error !== undefined) {
me.error(data);
}
}
});
......
......@@ -36,7 +36,7 @@ var Feng = {
position: 'bottom-right',
loaderBg: '#ff6849',
icon: 'info',
hideAfter: 2000,
hideAfter: 3000,
stack: 6
});
},
......@@ -47,7 +47,7 @@ var Feng = {
position: 'bottom-right',
loaderBg: '#ff6849',
icon: 'success',
hideAfter: 2000,
hideAfter: 3000,
stack: 6
});
},
......@@ -58,7 +58,7 @@ var Feng = {
position: 'bottom-right',
loaderBg: '#ff6849',
icon: 'error',
hideAfter: 2000,
hideAfter: 3000,
stack: 6
});
},
......
......@@ -32,10 +32,6 @@ UserInfoDlg.validateForm = function () {
var data = UserInfoDlg.data;
if (data.account && data.password && data.name && data.deptid) {
return true;
}
if (!data.account) {
return "请输入账号";
}
......@@ -48,6 +44,8 @@ UserInfoDlg.validateForm = function () {
if (!data.deptid) {
return "请选择部门";
}
return true;
};
/**
......
......@@ -25,10 +25,6 @@ UserPwdPage.validateForm = function () {
var data = UserPwdPage.data;
if (data.oldPassword && data.newPassword && data.repeatPassword) {
return true;
}
if (!data.oldPassword) {
return "请输入旧密码";
}
......@@ -39,6 +35,7 @@ UserPwdPage.validateForm = function () {
return "两次密码输入不一致";
}
return true;
};
/**
......@@ -61,7 +58,12 @@ $(function () {
data: UserPwdPage.data,
methods: {
ensure: function () {
UserPwdPage.chPwd();
var validateForm = UserPwdPage.validateForm();
if (validateForm === true) {
UserPwdPage.chPwd();
} else {
Feng.alert(validateForm);
}
},
reset: function () {
UserPwdPage.reset();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment