내정보 > 비밀번호 확인 추가 + 값체크 추가.
This commit is contained in:
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -13,10 +13,16 @@ uri.front.statistics=\uD1B5\uACC4
|
|||||||
# \uB0B4\uC815\uBCF4
|
# \uB0B4\uC815\uBCF4
|
||||||
uri.front.info=\uB0B4\uC815\uBCF4
|
uri.front.info=\uB0B4\uC815\uBCF4
|
||||||
uri.front.info.path=/info
|
uri.front.info.path=/info
|
||||||
|
|
||||||
uri.front.info.user=\uAC1C\uC778\uC815\uBCF4
|
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=\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=\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=\uC740\uD589 \uC790\uB3D9\uC774\uCCB4 \uB0B4\uC5ED
|
||||||
|
uri.front.info.bank.path=/info/bank
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -149,12 +149,34 @@ var ajaxUtil = {
|
|||||||
},
|
},
|
||||||
422:function(rstData, status) {
|
422:function(rstData, status) {
|
||||||
console.log(rstData)
|
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 = $('<ul class="input-info"></ul>').appendTo(component);
|
||||||
|
}
|
||||||
|
infoBox.html('<li>' + oj.message + '</li>');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('.invalid-feedback').length === 0) {
|
if ($('.invalid-feedback').length === 0) {
|
||||||
|
|||||||
72
front/src/main/resources/templates/info/user/password.html
Normal file
72
front/src/main/resources/templates/info/user/password.html
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
|
||||||
|
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
||||||
|
<main id="content" role="main">
|
||||||
|
<div class="inner">
|
||||||
|
<hgroup class="tit-group">
|
||||||
|
<h3>
|
||||||
|
개인정보 보호를 위해 <br>
|
||||||
|
<strong>비밀번호를 다시 입력</strong>해 주세요.
|
||||||
|
</h3>
|
||||||
|
<p>본인 확인 후 개인정보 변경이 가능합니다.</p>
|
||||||
|
</hgroup>
|
||||||
|
|
||||||
|
<section class="form-group">
|
||||||
|
<form method="post" name="reqForm" id="reqForm" onsubmit="formControl.authInfoUser();" th:action="@{/}" >
|
||||||
|
|
||||||
|
<div class="component-input" data-props-toggle-Password="true">
|
||||||
|
<div class="input-label">
|
||||||
|
<label for="temp_input_0001" class="label-txt">
|
||||||
|
비밀번호
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="password" id="temp_input_0001" placeholder="비밀번호 4자리를 입력해 주세요" name="password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="component-btns">
|
||||||
|
<div class="btns-row">
|
||||||
|
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.authInfoUser()">
|
||||||
|
<span class="btn-txt">다음</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
let ENV = {
|
||||||
|
httpUrl: {
|
||||||
|
root: /*[[#{uri.front.info.user.path}]]*/'rootUrl',
|
||||||
|
auth: /*[[|/api/front#{uri.front.info.user.path}/password/auth|]]*/'passwordAuthUrl',
|
||||||
|
|
||||||
|
},
|
||||||
|
submitted: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let formControl = {
|
||||||
|
authInfoUser() {
|
||||||
|
const f = document.reqForm;
|
||||||
|
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
ajaxUtil._ajaxAsync(
|
||||||
|
ENV.httpUrl.auth,
|
||||||
|
obj,
|
||||||
|
function (rstData, status) {
|
||||||
|
console.log(rstData.status)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user