Skip to content
Snippets Groups Projects
Commit b8d26900 authored by Tini Tran's avatar Tini Tran
Browse files

it is unnecessary to return token, when creating an user. we just give user a...

it is unnecessary to return token, when creating an user. we just give user a message if user creation was successful
parent bf13a8ef
No related branches found
No related tags found
No related merge requests found
...@@ -44,8 +44,7 @@ public class AuthController { ...@@ -44,8 +44,7 @@ public class AuthController {
public ResponseEntity<String> signup(@RequestBody SignUpRequest signUpRequest){ public ResponseEntity<String> signup(@RequestBody SignUpRequest signUpRequest){
if(!authenticationService.credentialsExists(signUpRequest)){ if(!authenticationService.credentialsExists(signUpRequest)){
userService.createUser(signUpRequest); userService.createUser(signUpRequest);
User user = userService.getUserByUsername(signUpRequest.getUsername()); return new ResponseEntity<>("Successfully created user!", HttpStatus.CREATED);
return new ResponseEntity<>(jwtService.generateToken(Long.toString(user.getId())), HttpStatus.CREATED);
} else return new ResponseEntity<>("The mail or username already exists!", HttpStatus.BAD_REQUEST); } else return new ResponseEntity<>("The mail or username already exists!", HttpStatus.BAD_REQUEST);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment