mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
resend code added
This commit is contained in:
@@ -22,10 +22,16 @@ public class EmailController {
|
||||
|
||||
|
||||
@PostMapping("/send")
|
||||
public String send(@RequestParam String email) {
|
||||
String otp = emailService.sendOtpEmail(email);
|
||||
return "OTP sent to " + email + " (for demo, OTP: " + otp + ")";
|
||||
public ResponseEntity<?> send(@RequestParam String email) {
|
||||
|
||||
if (!otpStore.canResend(email)) {
|
||||
return ResponseEntity.status(429).body("Please wait before requesting another code.");
|
||||
}
|
||||
|
||||
emailService.sendOtpEmail(email);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/verify")
|
||||
public ResponseEntity<String> verify(@RequestParam String email, @RequestParam String otp) {
|
||||
|
||||
Reference in New Issue
Block a user