mirror of https://github.com/halo-dev/halo
Translate some exception message.
parent
9630f9a2bb
commit
c563137577
|
@ -5,6 +5,7 @@ import run.halo.app.model.dto.UserDTO;
|
|||
import run.halo.app.model.entity.User;
|
||||
import run.halo.app.model.params.PasswordParam;
|
||||
import run.halo.app.model.params.UserParam;
|
||||
import run.halo.app.model.support.BaseResponse;
|
||||
import run.halo.app.model.support.UpdateCheck;
|
||||
import run.halo.app.service.UserService;
|
||||
import run.halo.app.utils.ValidationUtils;
|
||||
|
@ -45,7 +46,8 @@ public class UserController {
|
|||
}
|
||||
|
||||
@PutMapping("profiles/password")
|
||||
public void updatePassword(@RequestBody @Valid PasswordParam passwordParam, User user) {
|
||||
public BaseResponse updatePassword(@RequestBody @Valid PasswordParam passwordParam, User user) {
|
||||
userService.updatePassword(passwordParam.getOldPassword(), passwordParam.getNewPassword(), user.getId());
|
||||
return BaseResponse.ok("密码修改成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class UserServiceImpl extends AbstractCrudService<User, Integer> implemen
|
|||
Assert.notNull(userId, "User id must not be blank");
|
||||
|
||||
if (oldPassword.equals(newPassword)) {
|
||||
throw new BadRequestException("There is nothing changed because new password is equal to old password");
|
||||
throw new BadRequestException("新密码和旧密码不能相同");
|
||||
}
|
||||
|
||||
// Get the user
|
||||
|
@ -114,7 +114,7 @@ public class UserServiceImpl extends AbstractCrudService<User, Integer> implemen
|
|||
|
||||
// Check the user old password
|
||||
if (!BCrypt.checkpw(oldPassword, user.getPassword())) {
|
||||
throw new BadRequestException("Old password is mismatch").setErrorData(oldPassword);
|
||||
throw new BadRequestException("旧密码错误").setErrorData(oldPassword);
|
||||
}
|
||||
|
||||
// Set new password
|
||||
|
|
Loading…
Reference in New Issue