🐛 找回密码问题修复

🐛 找回密码问题修复
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 * @param password
* @return * @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 @Override
public Map forgetPassword(String code, String password) { public Map forgetPassword(String code, String password) {
Map map = new HashMap<>(2); Map map = new HashMap<>(2);
String account = redisService.get(code); String email = redisService.get(code);
System.out.println("account:\n"+account); if(StringUtils.isBlank(email)){
if(StringUtils.isBlank(account)){
map.put("message","链接已失效"); map.put("message","链接已失效");
} else { } else {
userMapper.updatePasswordByAccount(account,Utils.entryptPassword(password)); userMapper.updatePasswordByEmail(email,Utils.entryptPassword(password));
map.put("message","修改成功,正在跳转登录登陆界面!"); map.put("message","修改成功,正在跳转登录登陆界面!");
map.put("flag",1); map.put("flag",1);
} }

View File

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