个人中心修改密码
This commit is contained in:
@ -125,17 +125,6 @@ public class AppAuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 退出登录
|
|
||||||
*/
|
|
||||||
@PostMapping("/logout")
|
|
||||||
public R<Void> logout() {
|
|
||||||
loginService.logout();
|
|
||||||
return R.ok("退出成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户注销
|
* 用户注销
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,54 @@
|
|||||||
|
package com.fuyuanshen.app.controller;
|
||||||
|
|
||||||
|
import com.fuyuanshen.app.model.AppRegisterBody;
|
||||||
|
import com.fuyuanshen.app.service.AppLoginService;
|
||||||
|
import com.fuyuanshen.app.service.AppRegisterService;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP我的
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/userCenter")
|
||||||
|
public class AppUserCenterController {
|
||||||
|
|
||||||
|
private final AppLoginService loginService;
|
||||||
|
private final AppRegisterService registerService;
|
||||||
|
/**
|
||||||
|
* 用户注销
|
||||||
|
*/
|
||||||
|
@PostMapping("/cancelAccount")
|
||||||
|
public R<Void> cancelAccount() {
|
||||||
|
loginService.cancelAccount();
|
||||||
|
return R.ok("用户注销成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改密码
|
||||||
|
*/
|
||||||
|
@PostMapping("/updatePassword")
|
||||||
|
public R<Void> updatePassword(@Validated @RequestBody AppRegisterBody body) {
|
||||||
|
registerService.updatePassword(body);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
*/
|
||||||
|
@PostMapping("/logout")
|
||||||
|
public R<Void> logout() {
|
||||||
|
loginService.logout();
|
||||||
|
return R.ok("退出成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,7 @@ import com.fuyuanshen.common.core.utils.SpringUtils;
|
|||||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||||
import com.fuyuanshen.common.log.event.LogininforEvent;
|
import com.fuyuanshen.common.log.event.LogininforEvent;
|
||||||
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||||
|
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||||
import com.fuyuanshen.common.tenant.helper.TenantHelper;
|
import com.fuyuanshen.common.tenant.helper.TenantHelper;
|
||||||
import com.fuyuanshen.common.web.config.properties.CaptchaProperties;
|
import com.fuyuanshen.common.web.config.properties.CaptchaProperties;
|
||||||
import com.fuyuanshen.system.domain.SysUser;
|
import com.fuyuanshen.system.domain.SysUser;
|
||||||
@ -142,4 +143,13 @@ public class AppRegisterService {
|
|||||||
.set("password", password);
|
.set("password", password);
|
||||||
userMapper.update(updateWrapper);
|
userMapper.update(updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updatePassword(AppRegisterBody body) {
|
||||||
|
String username = AppLoginHelper.getUsername();
|
||||||
|
String password = body.getPassword();
|
||||||
|
UpdateWrapper<AppUser> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("user_name", username)
|
||||||
|
.set("password", password);
|
||||||
|
userMapper.update(updateWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user