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 19
19
import org .springframework .security .core .GrantedAuthority ;
20
20
import org .springframework .security .core .context .SecurityContextHolder ;
21
21
import org .springframework .security .crypto .password .PasswordEncoder ;
22
+ import org .springframework .validation .annotation .Validated ;
22
23
import org .springframework .web .bind .annotation .CrossOrigin ;
23
24
import org .springframework .web .bind .annotation .PostMapping ;
24
25
import org .springframework .web .bind .annotation .RequestBody ;
34
35
@ CrossOrigin (origins = "*" , maxAge = 3600 )
35
36
@ RestController
36
37
@ RequiredArgsConstructor
38
+ @ Validated
37
39
@ RequestMapping ("/api/auth" )
38
40
public class AuthController {
39
41
Original file line number Diff line number Diff line change 3
3
import lombok .Value ;
4
4
5
5
import javax .validation .constraints .Email ;
6
+ import javax .validation .constraints .NotBlank ;
6
7
import javax .validation .constraints .Size ;
7
8
import java .util .Set ;
8
9
9
10
@ Value
10
11
public class SignupRequest {
11
12
13
+ @ NotBlank (message = "username is required" )
12
14
@ Size (min = 3 , max = 20 )
13
15
String username ;
14
16
17
+ @ NotBlank (message = "email is required" )
15
18
@ Size (max = 50 )
16
- @ Email
19
+ @ Email ( message = "email is not valid" )
17
20
String email ;
18
21
19
22
Set <String > roles ;
20
23
24
+ @ NotBlank (message = "password is required" )
21
25
@ Size (min = 6 , max = 40 )
22
26
String password ;
23
27
You can’t perform that action at this time.
0 commit comments