1010import org .ezcode .codetest .application .usermanagement .user .dto .response .VerifyFindPasswordResponse ;
1111import org .ezcode .codetest .domain .user .model .entity .AuthUser ;
1212import org .ezcode .codetest .domain .user .exception .UserException ;
13+ import org .springframework .beans .factory .annotation .Value ;
1314import org .springframework .http .HttpStatus ;
1415import org .springframework .http .ResponseEntity ;
1516import org .springframework .security .core .annotation .AuthenticationPrincipal ;
4041public class UserVerifyController {
4142 private final AuthService authService ;
4243
44+ @ Value ("${app.redirect.verify.url}" )
45+ String verifyUrl ;
46+
4347 @ Operation (summary = "이메일 인증 코드 전송" , description = "현재 로그인된 회원의 이메일로 인증 코드를 전송합니다." )
4448 @ PostMapping ("/email/send" )
4549 public ResponseEntity <SendEmailResponse > sendMailCode (
@@ -59,25 +63,25 @@ public void verifyEmailCode(
5963 ) throws IOException {
6064 try {
6165 authService .verifyEmailCode (email , key );
62-
66+
6367 // 성공 시 프론트엔드로 리디렉션
6468 String redirectUrl = UriComponentsBuilder
65- .fromUriString ("https://ezcode.my/email-verify-success" )
69+ .fromUriString (verifyUrl )
6670 .queryParam ("status" , "success" )
6771 .build ()
6872 .toUriString ();
69-
73+
7074 response .sendRedirect (redirectUrl );
7175 } catch (UserException e ) {
7276 // 실패 시 프론트엔드로 리디렉션 (에러 메시지 포함)
7377 String errorMessage = URLEncoder .encode (e .getMessage (), StandardCharsets .UTF_8 );
7478 String redirectUrl = UriComponentsBuilder
75- .fromUriString ("https://ezcode.my/email-verify-failure" )
79+ .fromUriString (verifyUrl )
7680 .queryParam ("status" , "failure" )
7781 .queryParam ("message" , errorMessage )
7882 .build ()
7983 .toUriString ();
80-
84+
8185 response .sendRedirect (redirectUrl );
8286 }
8387 }
0 commit comments