🐛 找回密码问题修复

🐛 找回密码问题修复
This commit is contained in:
ronger 2021-09-14 21:01:58 +08:00 committed by GitHub
commit 5a85adc384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View File

@ -46,11 +46,11 @@ public interface UserMapper extends Mapper<User> {
/**
* 修改用户密码
* @param account
* @param email
* @param password
* @return
*/
Integer updatePasswordByAccount(@Param("account") String account, @Param("password") String password);
Integer updatePasswordByEmail(@Param("email") String email, @Param("password") String password);
/**
* 获取用户权限权重

View File

@ -131,12 +131,11 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
@Override
public Map forgetPassword(String code, String password) {
Map map = new HashMap<>(2);
String account = redisService.get(code);
System.out.println("account:\n"+account);
if(StringUtils.isBlank(account)){
String email = redisService.get(code);
if(StringUtils.isBlank(email)){
map.put("message","链接已失效");
} else {
userMapper.updatePasswordByAccount(account,Utils.entryptPassword(password));
userMapper.updatePasswordByEmail(email,Utils.entryptPassword(password));
map.put("message","修改成功,正在跳转登录登陆界面!");
map.put("flag",1);
}

View File

@ -50,8 +50,8 @@
<insert id="insertUserRole">
insert into forest_user_role (id_user,id_role,created_time) values (#{idUser},#{idRole},sysdate())
</insert>
<update id="updatePasswordByAccount">
update forest_user set password = #{password} where account = #{account}
<update id="updatePasswordByEmail">
update forest_user set password = #{password} where email = #{email}
</update>
<update id="updateUserRole">
update forest_user_role set id_role = #{idRole},created_time = sysdate() where id_user = #{idUser}