feat(user): 添加更新用户名功能并优化安全配置
- 在 ErrorCode 中新增 USER_UPDATE_USERNAME_FAILED 错误码 - JwtAuthenticationTokenFilter 中增加当前用户名属性设置 - RestAuthenticationEntryPoint 返回状态码改为 403 并更新错误信息 - 新增 UpdateUsernameRequest DTO 用于接收用户名更新请求 - UserController 添加 updateUsername 接口支持修改用户名 - UserInfoService 和其实现类中增加 updateUsername 方法逻辑 - 引入 tokenHead 配置项以支持 JWT 相关操作
This commit is contained in:
@@ -34,4 +34,12 @@ public interface UserInfoService {
|
||||
* @param password 密码
|
||||
*/
|
||||
void setUserPassword(@Pattern(regexp = "^[0-9]+$", message = "用户id格式错误") String userId, @Pattern(regexp = "^.{8,16}$", message = "密码长度需为8-16位") String password);
|
||||
|
||||
/**
|
||||
* 更新用户名
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param newUsername 新用户名
|
||||
*/
|
||||
void updateUsername(String username, String newUsername);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user