Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

import com.backend.elearning.domain.student.StudentVm;
import com.backend.elearning.domain.user.UserVm;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.data.repository.query.Param;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RequestMapping(value = "/api/v1/auth")
@RestController
@Validated
public class AuthenticationController {

private final AuthenticationService authenticationService;
Expand All @@ -18,6 +22,7 @@ public AuthenticationController(AuthenticationService authenticationService) {
}

@PostMapping("/forgotpassword")
@Operation(method = "POST", summary = "Recover password", description ="Send a request via this API to send an email to recover password" )
public ResponseEntity<Void> forgotPassword (
@Param("email") String email
) {
Expand All @@ -26,8 +31,9 @@ public ResponseEntity<Void> forgotPassword (
}

@PutMapping("/password")
@Operation(method = "PUT", summary = "Update password", description ="Send a request via this API to update password" )
public ResponseEntity<Void> forgotPassword (
@RequestBody AuthenticationPostVm request
@Valid @RequestBody AuthenticationPostVm request
) {
authenticationService.updatePassword(request);
return ResponseEntity.noContent().build();
Expand All @@ -52,6 +58,7 @@ ResponseEntity<AuthenticationVm> outboundAuthenticateForMobile(


@PostMapping("/login")
@Operation(method = "POST", summary = "Send request to sign in system", description ="Send a request via this API to login" )
public ResponseEntity<AuthenticationVm> login (
@RequestBody AuthenticationPostVm request
) {
Expand All @@ -61,6 +68,7 @@ public ResponseEntity<AuthenticationVm> login (
}

@PostMapping("/register")
@Operation(method = "POST", summary = "Send request to create new user", description ="Send a request via this API to create new user" )
public ResponseEntity<AuthenticationVm> register (
@RequestBody RegistrationPostVm request
) {
Expand All @@ -81,6 +89,7 @@ public ResponseEntity<String> verify (


@PostMapping("/resend")
@Operation(method = "POST", summary = "Resend verificationCode to recover password user", description ="Send a request via this API to resend token" )
public ResponseEntity<?> resendVerificationCode(@RequestParam String email) {
authenticationService.resendVerificationCode(email);
return ResponseEntity.ok("Verification code sent");
Expand Down
Loading