front 로그인 작업 중 (2)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package app.module.core.config.adapters.persistence.component;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AuditCommand {
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private LocalDateTime deletedAt;
|
||||
private String deletedBy;
|
||||
|
||||
public void create() {
|
||||
this.createdAt = LocalDateTime.now();
|
||||
this.createdBy = CommonUtil.getLoginUsername();
|
||||
this.updatedAt = LocalDateTime.now();
|
||||
this.updatedBy = CommonUtil.getLoginUsername();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.updatedAt = LocalDateTime.now();
|
||||
this.updatedBy = CommonUtil.getLoginUsername();
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
this.updatedAt = LocalDateTime.now();
|
||||
this.updatedBy = CommonUtil.getLoginUsername();
|
||||
this.deletedAt = LocalDateTime.now();
|
||||
this.deletedBy = CommonUtil.getLoginUsername();
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,11 @@ public class Household extends AuditEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String household_num;
|
||||
private String householdNum;
|
||||
|
||||
private String owner_name;
|
||||
private String ownerName;
|
||||
|
||||
private Integer owner_age;
|
||||
private Integer ownerAge;
|
||||
|
||||
private String tel;
|
||||
|
||||
@@ -27,27 +27,25 @@ public class Household extends AuditEntity {
|
||||
|
||||
private String password;
|
||||
|
||||
private String zipcode;
|
||||
|
||||
private String region;
|
||||
|
||||
private String city;
|
||||
|
||||
private String address_detail;
|
||||
private String addressDetail;
|
||||
|
||||
private Integer industry_large_code;
|
||||
private Integer industryLargeCode;
|
||||
|
||||
private Integer industry_middle_code;
|
||||
private Integer industryMiddleCode;
|
||||
|
||||
private Integer industry_small_code;
|
||||
private Integer industrySmallCode;
|
||||
|
||||
private Integer scale_code;
|
||||
private Integer scaleCode;
|
||||
|
||||
private Integer employment_code;
|
||||
private Integer employmentCode;
|
||||
|
||||
private Boolean is_panel;
|
||||
private Boolean isPanel;
|
||||
|
||||
private String memo;
|
||||
|
||||
private String drop_reason;
|
||||
private String dropReason;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.core.config.application.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CreateCommand {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.core.config.application.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DeleteCommand {}
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.core.config.application.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface UpdateCommand {}
|
||||
@@ -0,0 +1,38 @@
|
||||
package app.module.core.config.application.aop;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class AuditCommandAspect {
|
||||
@Before("@annotation(app.module.core.config.application.annotation.CreateCommand)")
|
||||
public void applyCreateAudit(JoinPoint joinPoint) {
|
||||
inject(joinPoint, "create");
|
||||
}
|
||||
|
||||
@Before("@annotation(app.module.core.config.application.annotation.UpdateCommand)")
|
||||
public void applyUpdateAudit(JoinPoint joinPoint) {
|
||||
inject(joinPoint, "update");
|
||||
}
|
||||
|
||||
@Before("@annotation(app.module.core.config.application.annotation.DeleteCommand)")
|
||||
public void applyDeleteAudit(JoinPoint joinPoint) {
|
||||
inject(joinPoint, "delete");
|
||||
}
|
||||
|
||||
private void inject(JoinPoint joinPoint, String type) {
|
||||
for (Object arg : joinPoint.getArgs()) {
|
||||
if (arg instanceof AuditCommand audit) {
|
||||
switch (type) {
|
||||
case "create" -> audit.create();
|
||||
case "update" -> audit.update();
|
||||
case "delete" -> audit.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package app.module.core.usecase.household.getHousehold.adapters.persistence;
|
||||
|
||||
import app.module.core.config.adapters.web.security.domain.CoreRole;
|
||||
import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHousehold;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -22,7 +22,6 @@ public class GetHousehold {
|
||||
private String tel;
|
||||
private String phone;
|
||||
private String password;
|
||||
private String zipcode;
|
||||
private String region;
|
||||
private String city;
|
||||
private String addressDetail;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.core.usecase.household.updateFrontHousehold.adapters.persistence;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortOut;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class UpdateFrontHouseholdDao implements UpdateFrontHouseholdPortOut {
|
||||
private final UpdateFrontHouseholdMapper mapper;
|
||||
|
||||
@Override
|
||||
public void operate(UpdateFrontHouseholdCmd cmd) {
|
||||
mapper.update(cmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.core.usecase.household.updateFrontHousehold.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UpdateFrontHouseholdMapper {
|
||||
void update(UpdateFrontHouseholdCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.core.usecase.household.updateFrontHousehold.ports;
|
||||
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
|
||||
|
||||
public interface UpdateFrontHouseholdPortIn {
|
||||
void operate(UpdateFrontHouseholdCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.core.usecase.household.updateFrontHousehold.ports;
|
||||
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
|
||||
|
||||
public interface UpdateFrontHouseholdPortOut {
|
||||
void operate(UpdateFrontHouseholdCmd cmd);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.core.usecase.household.updateFrontHousehold.ports.application;
|
||||
|
||||
import app.module.core.config.application.annotation.UpdateCommand;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortIn;
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortOut;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class UpdateFrontHouseholdService implements UpdateFrontHouseholdPortIn {
|
||||
private final UpdateFrontHouseholdPortOut portOut;
|
||||
|
||||
@Override
|
||||
@UpdateCommand
|
||||
public void operate(UpdateFrontHouseholdCmd cmd) { portOut.operate(cmd); }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.module.core.usecase.household.updateFrontHousehold.ports.application.domain;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class UpdateFrontHouseholdCmd extends AuditCommand {
|
||||
private Long id;
|
||||
private String householdNum;
|
||||
private String ownerName;
|
||||
private Integer ownerAge;
|
||||
private String tel;
|
||||
private String phone;
|
||||
private String region;
|
||||
private String city;
|
||||
private String addressDetail;
|
||||
}
|
||||
@@ -14,7 +14,6 @@
|
||||
tel,
|
||||
phone,
|
||||
password,
|
||||
zipcode,
|
||||
region,
|
||||
city,
|
||||
address_detail,
|
||||
@@ -54,7 +53,7 @@
|
||||
JOIN role r ON hhr.role_id = r.id AND r.is_deleted = false
|
||||
LEFT JOIN role_has_privilege rhp ON r.id = rhp.role_id AND rhp.is_deleted = false
|
||||
LEFT JOIN privilege p ON rhp.privilege_id = p.id AND p.is_deleted = false
|
||||
WHERE hhr.id = #{id}
|
||||
WHERE hhr.household_id = #{id}
|
||||
AND hhr.is_deleted = false
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
namespace="app.module.core.usecase.household.updateFrontHousehold.adapters.persistence.UpdateFrontHouseholdMapper">
|
||||
|
||||
<update id="update">
|
||||
UPDATE household
|
||||
SET
|
||||
owner_name = #{ownerName},
|
||||
owner_age = #{ownerAge},
|
||||
tel = #{tel},
|
||||
phone = #{phone},
|
||||
region = #{region},
|
||||
city = #{city},
|
||||
address_detail = #{addressDetail},
|
||||
<include refid="common.fields.UpdateBaseSet" />
|
||||
WHERE id = ${id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -27,7 +27,6 @@ import org.springframework.stereotype.Service;
|
||||
@RequiredArgsConstructor
|
||||
public class FrontDetailService implements UserDetailsService {
|
||||
|
||||
private final FindUserPortIn findUserPortIn;
|
||||
private final GetHouseholdPortIn getHouseholdPortIn;
|
||||
@Value("${app.front.password.validity.period.days}")
|
||||
private long passwordValidPeriodDays;
|
||||
@@ -40,24 +39,16 @@ public class FrontDetailService implements UserDetailsService {
|
||||
.operate(new GetHouseholdCmd(username))
|
||||
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
||||
|
||||
FindUser findUser =
|
||||
findUserPortIn
|
||||
.operate(new FindUserCmd(username))
|
||||
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
||||
|
||||
boolean accountLocked = Optional.ofNullable(findUser.getAccountLocked()).orElse(false);
|
||||
boolean accountDisabled = Optional.ofNullable(findUser.getAccountDisabled()).orElse(false);
|
||||
|
||||
return new FrontUser(
|
||||
findUser.getId(),
|
||||
findUser.getPassword(),
|
||||
!accountDisabled,
|
||||
return new FrontHouseholdUser(
|
||||
getHousehold.getHouseholdNum(),
|
||||
getHousehold.getPassword(),
|
||||
true,
|
||||
true,
|
||||
!accountLocked,
|
||||
getAuthorities(findUser.getRoles()),
|
||||
findUser.getNickname(),
|
||||
passwordValidPeriodDays - getDaysPassedFrom(findUser.getPasswordUpdatedAt()));
|
||||
true,
|
||||
true,
|
||||
getAuthorities(getHousehold.getRoles()),
|
||||
getHousehold.getOwnerName()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.module.front.config.application.security;
|
||||
|
||||
import java.util.Collection;
|
||||
import lombok.Getter;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
|
||||
@Getter
|
||||
public class FrontHouseholdUser extends User {
|
||||
|
||||
private String ownerName;
|
||||
|
||||
public FrontHouseholdUser(
|
||||
String householdNum,
|
||||
String password,
|
||||
boolean enabled,
|
||||
boolean accountNonExpired,
|
||||
boolean credentialsNonExpired,
|
||||
boolean accountNonLocked,
|
||||
Collection<? extends GrantedAuthority> authorities,
|
||||
String ownerName) {
|
||||
super(
|
||||
householdNum,
|
||||
password,
|
||||
enabled,
|
||||
accountNonExpired,
|
||||
credentialsNonExpired,
|
||||
accountNonLocked,
|
||||
authorities);
|
||||
this.ownerName = ownerName;
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,10 @@ public class FrontSecurityConfig {
|
||||
.rememberMe(
|
||||
remMe ->
|
||||
remMe
|
||||
.tokenValiditySeconds(1209600)
|
||||
// 자동 로그인 영구 유지 (로그아웃 시까지 유지)
|
||||
// Integer.MAX_VALUE ≒ 68년 유효
|
||||
// 단, 쿠키 삭제되면 무효됨
|
||||
.tokenValiditySeconds(Integer.MAX_VALUE)
|
||||
.userDetailsService(frontDetailService)
|
||||
.tokenRepository(persistentTokenRepository()))
|
||||
.logout(
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package app.module.front.usecase.household.updateFrontHousehold.adapters.web;
|
||||
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortIn;
|
||||
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import app.module.front.usecase.household.updateFrontHousehold.adapters.web.model.UpdateFrontHouseholdReqVO;
|
||||
import app.module.front.usecase.household.updateFrontHousehold.adapters.web.model.UpdateFrontHouseholdResVO;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class UpdateFrontHouseholdController {
|
||||
private final UpdateFrontHouseholdPortIn updateFrontHouseholdPortIn;
|
||||
|
||||
@PatchMapping(path = "/api/front/household/update")
|
||||
ResponseEntity<?> operate(
|
||||
@Valid UpdateFrontHouseholdReqVO reqVO, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult);
|
||||
}
|
||||
|
||||
updateFrontHouseholdPortIn.operate(new UpdateFrontHouseholdCmd(
|
||||
reqVO.getId(),
|
||||
reqVO.getHouseholdNum(),
|
||||
reqVO.getOwnerName(),
|
||||
reqVO.getOwnerAge(),
|
||||
reqVO.getTel(),
|
||||
reqVO.getPhone(),
|
||||
reqVO.getRegion(),
|
||||
reqVO.getCity(),
|
||||
reqVO.getAddressDetail()
|
||||
));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.front.usecase.household.updateFrontHousehold.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateFrontHouseholdReqVO {
|
||||
private Long id;
|
||||
private String householdNum;
|
||||
private String ownerName;
|
||||
private Integer ownerAge;
|
||||
private String tel;
|
||||
private String phone;
|
||||
private String region;
|
||||
private String city;
|
||||
private String addressDetail;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package app.module.front.usecase.household.updateFrontHousehold.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class UpdateFrontHouseholdResVO {
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package app.module.front.usecase.user.updateUserUI.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 app.module.core.usecase.user.findUser.ports.FindUserPortIn;
|
||||
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
|
||||
import app.module.front.usecase.user.updateUserUI.adapters.web.model.UpdateUserUIReqVO;
|
||||
@@ -14,13 +16,13 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@RequiredArgsConstructor
|
||||
class UpdateUserUIController {
|
||||
|
||||
private final FindUserPortIn findUserPortIn;
|
||||
private final GetHouseholdPortIn getHouseholdPortIn;
|
||||
|
||||
@GetMapping(path = "/user/info")
|
||||
String operate(Model model, @ModelAttribute("reqVO") UpdateUserUIReqVO reqVO) {
|
||||
|
||||
model.addAttribute("userInfo",
|
||||
findUserPortIn.operate(new FindUserCmd(CommonUtil.getLoginUsername())).orElseThrow());
|
||||
getHouseholdPortIn.operate(new GetHouseholdCmd(CommonUtil.getLoginUsername())).orElseThrow());
|
||||
|
||||
return "user/info";
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<a href="/login">[로그인]</a>
|
||||
</p>
|
||||
<p sec:authorize="isAuthenticated()" th:remove="tag">
|
||||
<strong th:text="${#authentication.principal.nickname}">로그인 사용자명</strong>
|
||||
<strong th:text="${#authentication.principal.ownerName}">로그인 사용자명</strong>
|
||||
<a href="/logout">[로그아웃]</a>
|
||||
<a href="/user/info">[정보수정]</a>
|
||||
</p>
|
||||
|
||||
@@ -35,48 +35,47 @@
|
||||
method="get"
|
||||
name="reqForm"
|
||||
th:action="@{/user/info}" th:object="${userInfo}">
|
||||
<input type="hidden" name="id" th:value="*{id}">
|
||||
<div>
|
||||
<label class="form-label d-block" for="profileImgFile">프로필 이미지</label>
|
||||
<div class="input-group w-50">
|
||||
<input accept="image/*" class="form-control"
|
||||
id="profileImgFile"
|
||||
name="profileImgFile"
|
||||
onchange="uiUtil.uploadFile('PROFILE_IMG', this);"
|
||||
type="file">
|
||||
<div class="invalid-feedback field-profileImgFile">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="userId">아이디</label>
|
||||
<input id="userId" name="id" placeholder="아이디" readonly="readonly" th:field="*{id}"
|
||||
<label for="householdNum">임가번호</label>
|
||||
<input id="householdNum" name="householdNum" placeholder="아이디" readonly="readonly" th:field="*{householdNum}"
|
||||
type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="nickname">닉네임</label>
|
||||
<input id="nickname" name="nickname" placeholder="닉네임" th:field="*{nickname}" type="text">
|
||||
<label for="ownerName">경영주</label>
|
||||
<input id="ownerName" name="ownerName" placeholder="경영주 이름" th:field="*{ownerName}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="userPwd">새 비밀번호</label>
|
||||
<input id="userPwd" name="password" placeholder="변경할 패스워드를 입력해주세요." th:field="*{password}"
|
||||
type="password">
|
||||
<div class="invalid-feedback field-password"></div>
|
||||
<label for="ownerAge">만나이</label>
|
||||
<input id="ownerAge" name="ownerAge" placeholder="나이" th:field="*{ownerAge}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="userPwdRe">새 비밀번호 재확인</label>
|
||||
<input id="userPwdRe" name="passwordRe" placeholder="변경할 패스워드를 재입력해주세요."
|
||||
type="password">
|
||||
<div class="invalid-feedback field-passwordRe"></div>
|
||||
<label for="tel">가구연락처</label>
|
||||
<input id="tel" name="tel" placeholder="가구연락처" th:field="*{tel}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="userEmail">이메일</label>
|
||||
<input id="userEmail" name="email" placeholder="이메일을 입력해주세요." th:field="*{email}"
|
||||
type="text">
|
||||
<div class="invalid-feedback field-email"></div>
|
||||
<label for="phone">핸드폰번호</label>
|
||||
<input id="phone" name="phone" placeholder="핸드폰번호" th:field="*{phone}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="region">시.도</label>
|
||||
<input id="region" name="region" placeholder="시.도" th:field="*{region}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="city">시.군.도</label>
|
||||
<input id="city" name="city" placeholder="시.군.도" th:field="*{city}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="addressDetail">세부 주소</label>
|
||||
<input id="addressDetail" name="addressDetail" placeholder="세부 주소" th:field="*{addressDetail}" type="text">
|
||||
<div class="invalid-feedback field-id"></div>
|
||||
</div>
|
||||
</form>
|
||||
<button onclick="updateUser();">수정하기</button>
|
||||
@@ -94,7 +93,7 @@
|
||||
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
url: '/api/front/user/update',
|
||||
url: '/api/front/household/update',
|
||||
data: obj,
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
@@ -102,7 +101,7 @@
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
if (confirm(`'${res.id}' 정보가 수정되었습니다.`)) {
|
||||
if (confirm(`'${res.ownerName} 님의' 정보가 수정되었습니다.`)) {
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
@@ -121,21 +120,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
const showProfileImage = () => {
|
||||
const f = document.reqForm;
|
||||
const uploadFile = [[${userInfo.uploadFile}]];
|
||||
|
||||
if (uploadFile != null) {
|
||||
const input = $(f.profileImgFile);
|
||||
input.parent().append(
|
||||
`<input type="hidden" name="fileMappingId" value="${uploadFile.id}"/>`);
|
||||
uiUtil.showFileInfo(input, uploadFile, true);
|
||||
}
|
||||
}
|
||||
|
||||
showProfileImage();
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user