File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
src/main/java/com/bezkoder/springjwt Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 1919import org .springframework .security .core .GrantedAuthority ;
2020import org .springframework .security .core .context .SecurityContextHolder ;
2121import org .springframework .security .crypto .password .PasswordEncoder ;
22+ import org .springframework .validation .annotation .Validated ;
2223import org .springframework .web .bind .annotation .CrossOrigin ;
2324import org .springframework .web .bind .annotation .PostMapping ;
2425import org .springframework .web .bind .annotation .RequestBody ;
3435@ CrossOrigin (origins = "*" , maxAge = 3600 )
3536@ RestController
3637@ RequiredArgsConstructor
38+ @ Validated
3739@ RequestMapping ("/api/auth" )
3840public class AuthController {
3941
Original file line number Diff line number Diff line change 33import lombok .Value ;
44
55import javax .validation .constraints .Email ;
6+ import javax .validation .constraints .NotBlank ;
67import javax .validation .constraints .Size ;
78import java .util .Set ;
89
910@ Value
1011public class SignupRequest {
1112
13+ @ NotBlank (message = "username is required" )
1214 @ Size (min = 3 , max = 20 )
1315 String username ;
1416
17+ @ NotBlank (message = "email is required" )
1518 @ Size (max = 50 )
16- @ Email
19+ @ Email ( message = "email is not valid" )
1720 String email ;
1821
1922 Set <String > roles ;
2023
24+ @ NotBlank (message = "password is required" )
2125 @ Size (min = 6 , max = 40 )
2226 String password ;
2327
You can’t perform that action at this time.
0 commit comments