配置微调

This commit is contained in:
walker 2023-06-05 13:19:15 +08:00
parent 946e329c42
commit ecf561d015
3 changed files with 6 additions and 11 deletions

View File

@ -26,7 +26,7 @@ public class ResponseExceptionHandler {
@ExceptionHandler(Exception.class)
public ProblemDetail UncaughtExceptionHandler(Exception e) {
ProblemDetail problemDetail = ProblemDetail.forStatus(HttpStatus.INTERNAL_SERVER_ERROR);
problemDetail.setTitle("处理异常");
problemDetail.setTitle("知错误");
problemDetail.setDetail(e.getMessage());
return problemDetail;
}

View File

@ -105,16 +105,6 @@ public class SpringSecurityConfiguration {
return jwtAuthenticationConverter;
}
/**
* Spring Security用户username/password认证使用的password编码器
*
* @return
*/
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder(13);
}
/**
* JWT解码器
*

View File

@ -26,6 +26,11 @@ public class UserService {
}
public String register(User user) {
BusinessExceptionAssertEnum.UNIQUE_FIELD_REPEAT.assertTrue(
this.userRepository.count(
Wrappers.<User>lambdaQuery().eq(User::getMobile, user.getMobile())) <= 0,
"手机号已经被注册"
);
user.setRegisterTime(LocalDateTime.now());
this.userRepository.save(user);
return user.getId() + "";