Commit abf52034 by fengshuonan

完善修改密码页面

parent ce5dc8a1
...@@ -167,15 +167,15 @@ public class UserMgrController extends BaseController { ...@@ -167,15 +167,15 @@ public class UserMgrController extends BaseController {
*/ */
@RequestMapping("/changePwd") @RequestMapping("/changePwd")
@ResponseBody @ResponseBody
public Object changePwd(@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) { public Object changePwd(@RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword) {
if (!newPwd.equals(rePwd)) { if (ToolUtil.isOneEmpty(oldPassword, newPassword)) {
throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH); throw new RequestEmptyException();
} }
Integer userId = ShiroKit.getUser().getId(); Integer userId = ShiroKit.getUser().getId();
User user = userService.selectById(userId); User user = userService.selectById(userId);
String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt()); String oldMd5 = ShiroKit.md5(oldPassword, user.getSalt());
if (user.getPassword().equals(oldMd5)) { if (user.getPassword().equals(oldMd5)) {
String newMd5 = ShiroKit.md5(newPwd, user.getSalt()); String newMd5 = ShiroKit.md5(newPassword, user.getSalt());
user.setPassword(newMd5); user.setPassword(newMd5);
user.updateById(); user.updateById();
return SUCCESS_TIP; return SUCCESS_TIP;
......
...@@ -128,6 +128,9 @@ ...@@ -128,6 +128,9 @@
<!--Custom JavaScript --> <!--Custom JavaScript -->
<script src="${ctxPath}/assets/common/static/js/custom.min.js"></script> <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> <script src="${ctxPath}/assets/common/plugins/styleswitcher/jQuery.style.switcher.js"></script>
......
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
<button class="btn btn-info" type="button" id="saveButton" \@click="ensure"> <button class="btn btn-info" type="button" id="saveButton" \@click="ensure">
<i class="ace-icon fa fa-check"></i> 保存 <i class="ace-icon fa fa-check"></i> 保存
</button> </button>
<button class="btn btn-danger m-l-10" type="button" id="closeButton" \@clic="reset"> <button class="btn btn-danger m-l-10" type="button" id="closeButton" \@click="reset">
<i class="ace-icon fa fa-close"></i> 关闭 <i class="ace-icon fa fa-close"></i> 重置
</button> </button>
</div> </div>
</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 @@ ...@@ -36,8 +36,8 @@
} }
}, },
error: function (data) { error: function (data) {
if (me.success !== undefined) { if (me.error !== undefined) {
me.success(data); me.error(data);
} }
} }
}); });
......
...@@ -36,7 +36,7 @@ var Feng = { ...@@ -36,7 +36,7 @@ var Feng = {
position: 'bottom-right', position: 'bottom-right',
loaderBg: '#ff6849', loaderBg: '#ff6849',
icon: 'info', icon: 'info',
hideAfter: 2000, hideAfter: 3000,
stack: 6 stack: 6
}); });
}, },
...@@ -47,7 +47,7 @@ var Feng = { ...@@ -47,7 +47,7 @@ var Feng = {
position: 'bottom-right', position: 'bottom-right',
loaderBg: '#ff6849', loaderBg: '#ff6849',
icon: 'success', icon: 'success',
hideAfter: 2000, hideAfter: 3000,
stack: 6 stack: 6
}); });
}, },
...@@ -58,7 +58,7 @@ var Feng = { ...@@ -58,7 +58,7 @@ var Feng = {
position: 'bottom-right', position: 'bottom-right',
loaderBg: '#ff6849', loaderBg: '#ff6849',
icon: 'error', icon: 'error',
hideAfter: 2000, hideAfter: 3000,
stack: 6 stack: 6
}); });
}, },
......
...@@ -32,10 +32,6 @@ UserInfoDlg.validateForm = function () { ...@@ -32,10 +32,6 @@ UserInfoDlg.validateForm = function () {
var data = UserInfoDlg.data; var data = UserInfoDlg.data;
if (data.account && data.password && data.name && data.deptid) {
return true;
}
if (!data.account) { if (!data.account) {
return "请输入账号"; return "请输入账号";
} }
...@@ -48,6 +44,8 @@ UserInfoDlg.validateForm = function () { ...@@ -48,6 +44,8 @@ UserInfoDlg.validateForm = function () {
if (!data.deptid) { if (!data.deptid) {
return "请选择部门"; return "请选择部门";
} }
return true;
}; };
/** /**
......
...@@ -25,10 +25,6 @@ UserPwdPage.validateForm = function () { ...@@ -25,10 +25,6 @@ UserPwdPage.validateForm = function () {
var data = UserPwdPage.data; var data = UserPwdPage.data;
if (data.oldPassword && data.newPassword && data.repeatPassword) {
return true;
}
if (!data.oldPassword) { if (!data.oldPassword) {
return "请输入旧密码"; return "请输入旧密码";
} }
...@@ -39,6 +35,7 @@ UserPwdPage.validateForm = function () { ...@@ -39,6 +35,7 @@ UserPwdPage.validateForm = function () {
return "两次密码输入不一致"; return "两次密码输入不一致";
} }
return true;
}; };
/** /**
...@@ -61,7 +58,12 @@ $(function () { ...@@ -61,7 +58,12 @@ $(function () {
data: UserPwdPage.data, data: UserPwdPage.data,
methods: { methods: {
ensure: function () { ensure: function () {
UserPwdPage.chPwd(); var validateForm = UserPwdPage.validateForm();
if (validateForm === true) {
UserPwdPage.chPwd();
} else {
Feng.alert(validateForm);
}
}, },
reset: function () { reset: function () {
UserPwdPage.reset(); 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