Max/Backend/RegisterEndPoint #105

Merged
tonitch merged 3 commits from Max/Backend/RegisterEndPoint into master 2024-03-14 23:30:14 +01:00
Showing only changes of commit 157e5951fc - Show all commits

View File

@ -2,6 +2,7 @@ package ovh.herisson.Clyde.EndPoints;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.Column;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
@ -49,19 +50,9 @@ public class LoginController {
@PostMapping("/register")
public ResponseEntity<String> register(@RequestBody InscriptionRequest inscriptionRequest){
authServ.register(inscriptionRequest);
String sessionToken = authServ.login();
if (sessionToken == null){
return new UnauthorizedResponse<>("Identifier or Password incorrect");
}
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.set("Set-Cookie",String.format("session_token=%s",sessionToken));
return ResponseEntity.ok().headers(responseHeaders).build();
return new ResponseEntity<>("Is OK", HttpStatus.OK);
}
}