bkoff用户修改密码界面改为单独页面
This commit is contained in:
+28
-4
@@ -269,9 +269,9 @@ public class ApiUserController {
|
||||
public Object updateAction(ApiUserModel model) {
|
||||
Long userId = model.getUserId();
|
||||
Map<String, Object> dataApiUser = new HashMap<String, Object>();
|
||||
Map<String, Object> user = new HashMap<String, Object>();
|
||||
// Map<String, Object> user = new HashMap<String, Object>();
|
||||
dataApiUser.put("email", model.getEmail());
|
||||
user.put("password", DigestUtils.md5Hex(model.getPassword()));
|
||||
// user.put("password", DigestUtils.md5Hex(model.getPassword()));
|
||||
dataApiUser.put("siteName", model.getSiteName());
|
||||
dataApiUser.put("ip", model.getIp());
|
||||
dataApiUser.put("company", model.getCompany());
|
||||
@@ -282,9 +282,9 @@ public class ApiUserController {
|
||||
dataApiUser.put("isMonitor", model.getIsMonitor());
|
||||
this.apiUserService.update(dataApiUser, userId);
|
||||
// 更改用户密码
|
||||
this.userService.updateById(user,userId);
|
||||
// this.userService.updateById(user,userId);
|
||||
// 刷新缓存
|
||||
this.apiUserService.clearApiUserAuthorityCache(userId);
|
||||
// this.apiUserService.clearApiUserAuthorityCache(userId);
|
||||
|
||||
|
||||
//ApiUserCfg.ApiUserCfgKey.EVALUATE_RATE
|
||||
@@ -297,6 +297,30 @@ public class ApiUserController {
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object doEditPwdAction(ApiUserModel model) {
|
||||
Long userId = model.getUserId();
|
||||
Map<String, Object> user = new HashMap<String, Object>();
|
||||
user.put("password", DigestUtils.md5Hex(model.getPassword()));
|
||||
//
|
||||
// // 更改用户密码
|
||||
this.userService.updateById(user,userId);
|
||||
// 刷新缓存
|
||||
this.apiUserService.clearApiUserAuthorityCache(userId);
|
||||
|
||||
model.setViewType("redirect");
|
||||
model.setViewParam("location", "/apiUser/edit?userId="+userId);
|
||||
return model;
|
||||
}
|
||||
public Object editPwdAction(ApiUserModel model) {
|
||||
Long userId = model.getUserId();
|
||||
User user = this.userService.findById(userId);
|
||||
ApiUserBo bo = new ApiUserBo();
|
||||
bo.setUserName(user.getUserName());
|
||||
bo.setDisplayName(user.getDisplayName());
|
||||
model.setApiUserBo(bo);
|
||||
return model;
|
||||
}
|
||||
|
||||
void modifyUserCfg(Long userId, ApiUserCfg.ApiUserCfgKey cfgKey, Object val) {
|
||||
if (userId != null && cfgKey != null) {
|
||||
ApiUserCfg apiUserCfg = this.apiUserCfgService.findByUserId(userId, cfgKey);
|
||||
|
||||
@@ -46,11 +46,17 @@
|
||||
<#-- <tr>-->
|
||||
<#-- <td>密码</td>-->
|
||||
<#-- <td><input id="resetPwd" type="button" value="重置密码"/></td>-->
|
||||
<#-- </tr>-->
|
||||
<#-- <tr>-->
|
||||
<#-- <td><b>密码</b></td>-->
|
||||
<#-- <td><input name="password" value="${apiUserBo.password!}" /></td>-->
|
||||
<#-- </tr>-->
|
||||
<tr>
|
||||
<td><b>密码</b></td>
|
||||
<td><input name="password" value="${apiUserBo.password!}" /></td>
|
||||
<td>
|
||||
<a href="../apiUser/editPwd?userId=${apiUserBo.userId!}">修改密码</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>账户类型</td>
|
||||
<td>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>api用户密码修改</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
<#include "/common_js.ftl" />
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="list">
|
||||
<table width="50%">
|
||||
<form id="submitForm" action="doEditPwd" method="post" >
|
||||
<tr>
|
||||
<td>用户名</td>
|
||||
<input id="userId" name="userId" value="${userId!}" type="hidden"/>
|
||||
<td>${apiUserBo.userName!}<#if (apiUserBo.displayName??)>(${apiUserBo.displayName!})</#if></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>新密码</b></td>
|
||||
<td><input name="password" value="${apiUserBo.password!}" /></td>
|
||||
</tr>
|
||||
</form>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input onclick="submitForm();" type="reset" value="修改"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function submitForm() {
|
||||
$("#submitForm").attr("action", "doEditPwd");
|
||||
$("#submitForm").submit();
|
||||
}
|
||||
|
||||
function isIP(strIP) {
|
||||
if (!strIP)
|
||||
return false;
|
||||
var re = /^(\d+)(\.(\d+)){0,3}$/g //匹配IP地址的正则表达式
|
||||
return re.test(strIP)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.fangjia;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class test {
|
||||
public static void main(String[] args) {
|
||||
while (true){
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
String password = scanner.nextLine();
|
||||
String p =DigestUtils.md5Hex(password);
|
||||
System.out.println(p);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user