fix forgot password

This commit is contained in:
dirgantarasiahaan
2023-05-28 18:08:10 +07:00
parent a32d5a499f
commit 9f1a9b9004
4 changed files with 85 additions and 10 deletions

View File

@ -3,14 +3,12 @@ package com.iconplus.smartproc.controller;
import com.iconplus.smartproc.helper.model.EmptyRequest;
import com.iconplus.smartproc.helper.model.EmptyResponse;
import com.iconplus.smartproc.model.request.ChangePasswordRequest;
import com.iconplus.smartproc.model.request.ForgotPasswordRequest;
import com.iconplus.smartproc.model.request.LoginRequest;
import com.iconplus.smartproc.model.request.RefreshTokenRequest;
import com.iconplus.smartproc.model.response.LoginResponse;
import com.iconplus.smartproc.model.response.RefreshTokenResponse;
import com.iconplus.smartproc.service.authentication.ChangePasswordService;
import com.iconplus.smartproc.service.authentication.LoginService;
import com.iconplus.smartproc.service.authentication.LogoutService;
import com.iconplus.smartproc.service.authentication.TokenManagementService;
import com.iconplus.smartproc.service.authentication.*;
import org.springframework.web.bind.annotation.*;
@CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true")
@ -18,19 +16,22 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/api/authentication")
public class AuthenticationController {
private LoginService loginService;
private TokenManagementService tokenManagementService;
private LogoutService logoutService;
private ChangePasswordService changePasswordService;
private final LoginService loginService;
private final TokenManagementService tokenManagementService;
private final LogoutService logoutService;
private final ChangePasswordService changePasswordService;
private final ForgotPasswordService forgotPasswordService;
public AuthenticationController(LoginService loginService,
TokenManagementService tokenManagementService,
LogoutService logoutService,
ChangePasswordService changePasswordService) {
ChangePasswordService changePasswordService,
ForgotPasswordService forgotPasswordService) {
this.loginService = loginService;
this.tokenManagementService = tokenManagementService;
this.logoutService = logoutService;
this.changePasswordService = changePasswordService;
this.forgotPasswordService = forgotPasswordService;
}
@PostMapping("/login")
@ -54,4 +55,9 @@ public class AuthenticationController {
return changePasswordService.execute(changePasswordRequest);
}
@PostMapping("/forgot-password")
public EmptyResponse forgotPassword(@RequestBody ForgotPasswordRequest forgotPasswordRequest) {
return forgotPasswordService.execute(forgotPasswordRequest);
}
}