配置微调
This commit is contained in:
parent
946e329c42
commit
ecf561d015
@ -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;
|
||||
}
|
||||
|
@ -105,16 +105,6 @@ public class SpringSecurityConfiguration {
|
||||
return jwtAuthenticationConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spring Security用户username/password认证使用的password编码器
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder(13);
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT解码器
|
||||
*
|
||||
|
@ -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() + "";
|
||||
|
Loading…
Reference in New Issue
Block a user