+ 개인정보 보호를 위해
+ 비밀번호를 다시 입력해 주세요.
+
+ 본인 확인 후 개인정보 변경이 가능합니다.
+ + +diff --git a/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/GetUserPasswordController.java b/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/GetUserPasswordController.java new file mode 100644 index 00000000..75d068f7 --- /dev/null +++ b/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/GetUserPasswordController.java @@ -0,0 +1,35 @@ +package app.module.front.usecase.info.user.getUserPasswordUI.adapters.web; + +import app.module.core.config.application.util.CommonUtil; +import app.module.core.config.application.util.CoreUtil; +import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn; +import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd; +import app.module.front.usecase.info.user.getUserPasswordUI.adapters.web.model.GetUserPasswordReqVO; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; + +@Controller +@RequiredArgsConstructor +class GetUserPasswordController { + + + private final CoreUtil coreUtil; + + private final GetHouseholdPortIn getHouseholdPortIn; + + @PostMapping(path = "/api/front/info/user/password/auth") + ResponseEntity> operate(@Valid GetUserPasswordReqVO reqVO, BindingResult bindingResult){ + if (bindingResult.hasErrors()) { + return coreUtil.getErrorInfo(bindingResult); + } + + return ResponseEntity.status(HttpStatus.OK).body(getHouseholdPortIn.operate(new GetHouseholdCmd(CommonUtil.getLoginUsername())).orElseThrow()); + } +} \ No newline at end of file diff --git a/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/GetUserPasswordUIController.java b/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/GetUserPasswordUIController.java new file mode 100644 index 00000000..e1a9b51f --- /dev/null +++ b/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/GetUserPasswordUIController.java @@ -0,0 +1,25 @@ +package app.module.front.usecase.info.user.getUserPasswordUI.adapters.web; + +import app.module.core.config.application.util.CommonUtil; +import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn; +import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +@RequiredArgsConstructor +class GetUserPasswordUIController { + + private final GetHouseholdPortIn getHouseholdPortIn; + + @GetMapping(path = "/info/user/password") + String operate(Model model) { + + model.addAttribute("userInfo", + getHouseholdPortIn.operate(new GetHouseholdCmd(CommonUtil.getLoginUsername())).orElseThrow()); + + return "info/user/password"; + } +} \ No newline at end of file diff --git a/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/model/GetUserPasswordReqVO.java b/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/model/GetUserPasswordReqVO.java new file mode 100644 index 00000000..f33a9422 --- /dev/null +++ b/front/src/main/java/app/module/front/usecase/info/user/getUserPasswordUI/adapters/web/model/GetUserPasswordReqVO.java @@ -0,0 +1,19 @@ +package app.module.front.usecase.info.user.getUserPasswordUI.adapters.web.model; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class GetUserPasswordReqVO { + + @NotNull(message = "비밀번호는 필수 입력값입니다.") + @Pattern(regexp = "\\d{6}", message = "비밀번호는 숫자 6자리여야 합니다.") + private String password; +} diff --git a/front/src/main/resources/messages/uri.properties b/front/src/main/resources/messages/uri.properties index 95ecbb7c..663c70b6 100644 --- a/front/src/main/resources/messages/uri.properties +++ b/front/src/main/resources/messages/uri.properties @@ -13,10 +13,16 @@ uri.front.statistics=\uD1B5\uACC4 # \uB0B4\uC815\uBCF4 uri.front.info=\uB0B4\uC815\uBCF4 uri.front.info.path=/info + uri.front.info.user=\uAC1C\uC778\uC815\uBCF4 +uri.front.info.user.path=/info/user +uri.front.info.user.password=\uBE44\uBC00\uBC88\uD638 \uD655\uC778 uri.front.info.notice=\uACF5\uC9C0\uC0AC\uD56D +uri.front.info.notice.path=/info/notice uri.front.info.monthly=\uC6D4\uBCC4 \uC784\uC0B0\uBB3C \uD604\uD669 +uri.front.info.monthly.path=/info/monthly uri.front.info.bank=\uC740\uD589 \uC790\uB3D9\uC774\uCCB4 \uB0B4\uC5ED +uri.front.info.bank.path=/info/bank diff --git a/front/src/main/resources/static/ui/ajaxUtil.js b/front/src/main/resources/static/ui/ajaxUtil.js index 87fca12d..2bc01d15 100644 --- a/front/src/main/resources/static/ui/ajaxUtil.js +++ b/front/src/main/resources/static/ui/ajaxUtil.js @@ -149,12 +149,34 @@ var ajaxUtil = { }, 422:function(rstData, status) { console.log(rstData) - $(rstData.responseJSON).each((idx, oj) => { - // TODO : form id? or body - let target = $('body').find('[name=' + oj.field + ']'); - target.addClass('is-invalid'); - target.parent().find('.invalid-feedback').text(oj.defaultMessage); + let isResetDone = false; + + $(rstData.responseJSON.fieldErrors).each((idx, oj) => { + const target = $('[name="' + oj.field + '"]'); + + if (!isResetDone) { + const formElement = target.closest('form'); + if (formElement.length > 0) { + $(formElement).find('.component-input').removeClass('input-invalid'); + $(formElement).find('.input-info').each(function () { + $(this).remove(); + }); + } + isResetDone = true; + } + + if (target.length > 0) { + const component = target.closest('.component-input'); + if(component){ + component.addClass('input-invalid'); + let infoBox = component.find('.input-info'); + if (infoBox.length === 0) { + infoBox = $('
본인 확인 후 개인정보 변경이 가능합니다.
+ + +