用户找回密码
This commit is contained in:
@@ -66,7 +66,7 @@ public class UserController {
|
||||
map.put("msg","验证码错误");
|
||||
return map;
|
||||
}
|
||||
map.put("code",0);
|
||||
|
||||
if(StringUtils.isEmpty(user.getUserLogin())||StringUtils.isEmpty(user.getUserPassword())){
|
||||
map.put("msg","用户或密码为空!");
|
||||
return map;
|
||||
@@ -75,10 +75,16 @@ public class UserController {
|
||||
User user1 = userService.userLogin(user);
|
||||
|
||||
if(user1!=null){
|
||||
|
||||
map.put("code",200);
|
||||
String token= tokenUtils.sign(user1);
|
||||
map.put("cod",1);
|
||||
map.put("data",user1);
|
||||
map.put("userEmail",user1.getUserEmail());
|
||||
map.put("userLogin",user1.getUserLogin());
|
||||
map.put("user",user1.getUserEmail());
|
||||
map.put("userStatus",user1.getUserStatus());
|
||||
map.put("Id",user1.getId());
|
||||
map.put("nickname",user1.getNickname());
|
||||
map.put("roleId",user1.getRoleId());
|
||||
map.put("userRegistered",user1.getUserRegistered());
|
||||
map.put("token",token);
|
||||
}else {
|
||||
map.put("msg","用户名或密码错误!");
|
||||
@@ -99,6 +105,36 @@ public class UserController {
|
||||
}
|
||||
|
||||
}
|
||||
@RequestMapping("/findThePassword")
|
||||
public Map<String,Object> findThePassword(User user,HttpSession session){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
User user1=userService.selectUserAlreadyExist(user);
|
||||
if (user1==null){
|
||||
map.put("msg","无此邮箱");
|
||||
return map;
|
||||
}
|
||||
// 比较验证码
|
||||
// if (!user.getActiveCode().equals((String) session.getAttribute(user.getUserEmail()))) {
|
||||
// map.put("msg","验证码不正确") ;
|
||||
// return map;
|
||||
// }
|
||||
|
||||
|
||||
if (user1 != null) {
|
||||
int result=userService.updatePassword(user1);
|
||||
if(result==1){
|
||||
map.put("Data",user1.getUserLogin());
|
||||
map.put("Data",user1.getUserEmail());
|
||||
map.put("msg","重置成功");
|
||||
return map;
|
||||
}else {
|
||||
map.put("msg","重置失败");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user