提交 befb250a 编写于 作者: 爱吃血肠's avatar 爱吃血肠

用户在线修改密码

上级 8216a17c
......@@ -107,4 +107,12 @@ public interface UserDao {
* @return
*/
public User queryUserByUserName(@Param("name") String name);
/**
* 更新密码通过用户名称即email
* @param email
* @param newPwd
* @return
*/
public int updatePasswordByName(@Param("name") String email, @Param("password") String newPwd);
}
\ No newline at end of file
......@@ -129,4 +129,11 @@ public interface UserService {
* @return
*/
public User queryUserById(String userEmail);
/**
* 更新密码通过用户名称即email
* @param email
* @param newPwd
*/
public void updatePasswordByName(String email, String newPwd);
}
\ No newline at end of file
......@@ -229,4 +229,17 @@ public class UserServiceImpl implements UserService {
return userDao.queryUserByEmails(userEmail);
}
/**
* 更新密码通过用户名称即email
* @param email
* @param newPwd
*/
@Override
public void updatePasswordByName(String email, String newPwd) {
String password = Md5Util.md5Password(newPwd);
if(1 != userDao.updatePasswordByName(email,newPwd)){
throw new RuntimeException("更新密码通过用户名称即email,更新影响行数不唯一");
}
}
}
\ No newline at end of file
......@@ -94,7 +94,7 @@ public class FindPwdController {
if(email == null){
response.sendRedirect("/user/login");
}
//userService.updatePasswordByName(email,newPwd);
userService.updatePasswordByName(email,newPwd);
} catch (BizException e) {
return new BaseResult<>(false, e.getMessage());
} catch (Exception e) {
......
......@@ -172,4 +172,11 @@
where
t_user.name = #{name}
</select>
<!-- 更新密码通过用户名称即email-->
<update id="updatePasswordByName">
update t_user set
password=#{password}
where name = #{name}
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册