forked from dyf/fys-Multi-tenant
个人中心修改密码2
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.fuyuanshen.app.controller;
|
||||
|
||||
import com.fuyuanshen.app.model.AppRegisterBody;
|
||||
import com.fuyuanshen.app.model.AppUpdatePasswordBody;
|
||||
import com.fuyuanshen.app.service.AppLoginService;
|
||||
import com.fuyuanshen.app.service.AppRegisterService;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
@ -38,7 +39,7 @@ public class AppUserCenterController {
|
||||
* 修改密码
|
||||
*/
|
||||
@PostMapping("/updatePassword")
|
||||
public R<Void> updatePassword(@Validated @RequestBody AppRegisterBody body) {
|
||||
public R<Void> updatePassword(@Validated @RequestBody AppUpdatePasswordBody body) {
|
||||
registerService.updatePassword(body);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.fuyuanshen.app.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppUpdatePasswordBody {
|
||||
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
private String password;
|
||||
}
|
||||
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.fuyuanshen.app.domain.AppUser;
|
||||
import com.fuyuanshen.app.mapper.AppUserMapper;
|
||||
import com.fuyuanshen.app.model.AppRegisterBody;
|
||||
import com.fuyuanshen.app.model.AppUpdatePasswordBody;
|
||||
import com.fuyuanshen.common.core.constant.Constants;
|
||||
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
||||
import com.fuyuanshen.common.core.domain.model.RegisterBody;
|
||||
@ -144,7 +145,7 @@ public class AppRegisterService {
|
||||
userMapper.update(updateWrapper);
|
||||
}
|
||||
|
||||
public void updatePassword(AppRegisterBody body) {
|
||||
public void updatePassword(AppUpdatePasswordBody body) {
|
||||
String username = AppLoginHelper.getUsername();
|
||||
String password = body.getPassword();
|
||||
UpdateWrapper<AppUser> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
@ -126,9 +126,8 @@ public class AppPasswordAuthStrategy implements IAuthStrategy {
|
||||
.eq(AppUser::getUserType, UserType.APP_USER.getUserType()));
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
log.info("登录用户:{} 不存在.", username);
|
||||
// throw new UserException("user.not.exists", phonenumber);
|
||||
// 新增AppUser用户
|
||||
return null;
|
||||
throw new UserException("user.not.exists", username);
|
||||
|
||||
} else if (SystemConstants.DISABLE.equals(user.getStatus())) {
|
||||
log.info("登录用户:{} 已被停用.", username);
|
||||
throw new UserException("user.blocked", username);
|
||||
|
||||
Reference in New Issue
Block a user