Merge branch 'dev' into deploy-dev-front
This commit is contained in:
@@ -58,7 +58,7 @@ public class RoleUpdateAspect {
|
|||||||
|
|
||||||
if (beforeAdmin.isPresent()) {
|
if (beforeAdmin.isPresent()) {
|
||||||
List<String> beforeRoles =
|
List<String> beforeRoles =
|
||||||
beforeAdmin.get().getRoles().stream().map(CoreRole::getId).toList();
|
beforeAdmin.stream().map(r -> r.getRole().getId()).toList();
|
||||||
if (beforeRoles.size() != currentRoles.size()
|
if (beforeRoles.size() != currentRoles.size()
|
||||||
|| currentRoles.stream().anyMatch(item -> !beforeRoles.contains(item))) {
|
|| currentRoles.stream().anyMatch(item -> !beforeRoles.contains(item))) {
|
||||||
createLog = true;
|
createLog = true;
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ public class AdminDetailsService implements UserDetailsService {
|
|||||||
adminUser.getSeq(),
|
adminUser.getSeq(),
|
||||||
adminUser.getId(),
|
adminUser.getId(),
|
||||||
adminUser.getPassword(),
|
adminUser.getPassword(),
|
||||||
adminUser.getRoles().stream().map(CoreRole::getId).findFirst().orElse(null),
|
adminUser.getRole().getId(),
|
||||||
adminUser.getRegionMainCode(),
|
adminUser.getRegionMainCode(),
|
||||||
adminUser.getLastLoginIp(),
|
adminUser.getLastLoginIp(),
|
||||||
!accountDisabled,
|
!accountDisabled,
|
||||||
true,
|
true,
|
||||||
isCredentialsNonExpired(adminUser.getPasswordUpdatedAt()),
|
isCredentialsNonExpired(adminUser.getPasswordUpdatedAt()),
|
||||||
!accountLocked,
|
!accountLocked,
|
||||||
getAuthorities(adminUser.getRoles()),
|
getAuthorities(Stream.of(adminUser.getRole()).toList()),
|
||||||
passwordValidPeriodDays - getDaysPassedFrom(adminUser.getPasswordUpdatedAt()));
|
passwordValidPeriodDays - getDaysPassedFrom(adminUser.getPasswordUpdatedAt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ public class AdminCreatePostController {
|
|||||||
savePortIn.apiConnect(bindingVO.getSeq(),
|
savePortIn.apiConnect(bindingVO.getSeq(),
|
||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getPassword(),
|
bindingVO.getPassword(),
|
||||||
bindingVO.getName(),
|
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?bindingVO.getName():null,
|
||||||
"010-"+bindingVO.getPhone1()+"-"+bindingVO.getPhone2(),
|
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?"010-"+bindingVO.getPhone1()+"-"+bindingVO.getPhone2():null,
|
||||||
bindingVO.getRegionMainCode(),
|
!"ROLE_ADMIN".equals(bindingVO.getRoleId())?bindingVO.getRegionMainCode():null,
|
||||||
bindingVO.getAccountDisabled(),
|
bindingVO.getAccountDisabled(),
|
||||||
bindingVO.getRoleId()));
|
bindingVO.getRoleId()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,19 +46,16 @@ class AdminUpdateGetController {
|
|||||||
|
|
||||||
AdminUpdateBindingVO bindingVO =
|
AdminUpdateBindingVO bindingVO =
|
||||||
new AdminUpdateBindingVO(
|
new AdminUpdateBindingVO(
|
||||||
output.getCreatedBy(),
|
|
||||||
output.getCreatedAt(),
|
|
||||||
output.getUpdatedBy(),
|
|
||||||
output.getUpdatedAt(),
|
|
||||||
output.getSeq(),
|
output.getSeq(),
|
||||||
output.getId(),
|
output.getId(),
|
||||||
null,
|
null,
|
||||||
output.getName(),
|
output.getName(),
|
||||||
output.getPhone(),
|
output.getPhone().split("-")[1],
|
||||||
|
output.getPhone().split("-")[2],
|
||||||
output.getRegionMainCode(),
|
output.getRegionMainCode(),
|
||||||
output.getPasswordUpdatedAt(),
|
output.getPasswordUpdatedAt(),
|
||||||
output.getAccountDisabled(),
|
output.getAccountDisabled(),
|
||||||
output.getRoles().stream().map(CoreRole::getId).collect(Collectors.toList()));
|
output.getRole().getId());
|
||||||
|
|
||||||
model.addAttribute("bindingVO", bindingVO);
|
model.addAttribute("bindingVO", bindingVO);
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
|||||||
@@ -9,16 +9,20 @@ import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
|||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class AdminUpdatePostController {
|
class AdminUpdatePostController {
|
||||||
|
|
||||||
@@ -28,34 +32,24 @@ class AdminUpdatePostController {
|
|||||||
private final SaveAdminPortIn saveAdminPortIn;
|
private final SaveAdminPortIn saveAdminPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@PostMapping(path = "/settings/admins/update/{id}")
|
@PostMapping(path = "/api/settings/admin/update")
|
||||||
String operate(
|
ResponseEntity<?> operate( @RequestBody AdminUpdateBindingVO bindingVO, BindingResult bindingResult) {
|
||||||
Model model,
|
|
||||||
RedirectAttributes redirectAttributes,
|
|
||||||
@Valid @ModelAttribute("bindingVO") AdminUpdateBindingVO bindingVO,
|
|
||||||
BindingResult bindingResult) {
|
|
||||||
|
|
||||||
adminUpdateValidator.validate(bindingVO, bindingResult);
|
adminUpdateValidator.validate(bindingVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY.value())
|
||||||
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
.body(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||||
return "admin/adminUpdateForm";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAdminPortIn.apiConnect(
|
return ResponseEntity.status(HttpStatus.OK).body(
|
||||||
bindingVO.getSeq(),
|
saveAdminPortIn.apiConnect(
|
||||||
bindingVO.getId(),
|
bindingVO.getSeq(),
|
||||||
bindingVO.getUpdatePassword(),
|
bindingVO.getId(),
|
||||||
bindingVO.getName(),
|
bindingVO.getUpdatePassword(),
|
||||||
bindingVO.getPhone(),
|
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?bindingVO.getName():null,
|
||||||
bindingVO.getRegionMainCode(),
|
"ROLE_RESEARCHER".equals(bindingVO.getRoleId())?"010-"+bindingVO.getPhone1()+"-"+bindingVO.getPhone2():null,
|
||||||
bindingVO.getAccountDisabled(),
|
!"ROLE_ADMIN".equals(bindingVO.getRoleId())? bindingVO.getRegionMainCode():null,
|
||||||
bindingVO.getRoleIds().stream().collect(Collectors.joining()));
|
bindingVO.getAccountDisabled(),
|
||||||
|
bindingVO.getRoleId()));
|
||||||
redirectAttributes.addFlashAttribute(
|
|
||||||
"operationMessage",
|
|
||||||
messageUtil.getMessage("operation.settings.admin.updated", bindingVO.getId()));
|
|
||||||
|
|
||||||
return "redirect:/settings/admins";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,16 @@
|
|||||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web.model;
|
package app.module.admin.usecase.admin.saveAdmin.adapters.web.model;
|
||||||
|
|
||||||
import app.module.core.config.application.component.AuditOutput;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.Pattern;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AdminUpdateBindingVO implements AuditOutput {
|
@NoArgsConstructor
|
||||||
|
public class AdminUpdateBindingVO{
|
||||||
private final String createdBy;
|
|
||||||
|
|
||||||
private final LocalDateTime createdAt;
|
|
||||||
|
|
||||||
private final String updatedBy;
|
|
||||||
|
|
||||||
private final LocalDateTime updatedAt;
|
|
||||||
|
|
||||||
private Long seq;
|
private Long seq;
|
||||||
private String id;
|
private String id;
|
||||||
@@ -33,12 +23,13 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
|||||||
message = "{valid.common.email.wrong}")
|
message = "{valid.common.email.wrong}")
|
||||||
private String email;*/
|
private String email;*/
|
||||||
private String name;
|
private String name;
|
||||||
private String phone;
|
private String phone1;
|
||||||
|
private String phone2;
|
||||||
private String regionMainCode;
|
private String regionMainCode;
|
||||||
|
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
/* private Integer loginFailCnt;
|
/* private Integer loginFailCnt;
|
||||||
private Boolean accountLocked;*/
|
private Boolean accountLocked;*/
|
||||||
private List<String> roleIds;
|
private String roleId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminUpdateBi
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.ValidationUtils;
|
||||||
import org.springframework.validation.Validator;
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class AdminUpdateValidator implements Validator {
|
public class AdminUpdateValidator implements Validator {
|
||||||
|
|
||||||
private final String PASSWORD_REGEX = "^((?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%_\\-])\\S{6,15})$";
|
// 비밀번호: 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상
|
||||||
|
private final String PASSWORD_REGEX = "^(?=.*[0-9])(?=.*[!@#$%_\\-]).{5}$";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(Class<?> clazz) {
|
public boolean supports(Class<?> clazz) {
|
||||||
@@ -20,23 +22,38 @@ public class AdminUpdateValidator implements Validator {
|
|||||||
public void validate(Object target, Errors errors) {
|
public void validate(Object target, Errors errors) {
|
||||||
AdminUpdateBindingVO vo = (AdminUpdateBindingVO) target;
|
AdminUpdateBindingVO vo = (AdminUpdateBindingVO) target;
|
||||||
|
|
||||||
Optional.ofNullable(vo.getRoleIds())
|
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
|
||||||
.filter(ids -> ids.size() < 1)
|
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요.");
|
||||||
.ifPresent(
|
}
|
||||||
ids ->
|
|
||||||
errors.rejectValue(
|
|
||||||
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
|
||||||
|
|
||||||
Optional.ofNullable(vo.getUpdatePassword())
|
Optional.ofNullable(vo.getUpdatePassword())
|
||||||
.filter(s -> !s.trim().isEmpty() && !s.matches(PASSWORD_REGEX))
|
.filter(password -> !password.trim().isEmpty() && !password.matches(PASSWORD_REGEX))
|
||||||
.ifPresent(s -> errors.rejectValue("updatePassword", "valid.common.password.wrong"));
|
.ifPresent(password -> errors.rejectValue("updatePassword", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
|
||||||
|
|
||||||
|
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||||
|
if (vo.getName() == null || vo.getName().isBlank()) {
|
||||||
|
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
|
||||||
|
}
|
||||||
|
if (vo.getName().length() > 4) {
|
||||||
|
errors.rejectValue("name", "error.name", "이름은 4자리까지 입력가능합니다.");
|
||||||
|
}
|
||||||
|
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||||
|
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
|
||||||
|
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||||
|
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
|
||||||
|
}
|
||||||
|
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) {
|
||||||
|
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
|
||||||
|
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
|
||||||
|
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||||
Optional.ofNullable(vo.getRoleIds())
|
Optional.ofNullable(vo.getRoleId())
|
||||||
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
.filter(id -> !id.equals("ROLE_ADMIN"))
|
||||||
.ifPresent(nonAdmins -> {
|
.ifPresent(nonAdmins -> {
|
||||||
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||||
errors.rejectValue("regionMainCode", "valid.common.required");
|
errors.rejectValue("regionMainCode", "valid.common.required","실사지역을 선택해주세요.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class HomeController {
|
|||||||
.ifPresent(
|
.ifPresent(
|
||||||
loginUser -> {
|
loginUser -> {
|
||||||
model.addAttribute("loginUser", loginUser);
|
model.addAttribute("loginUser", loginUser);
|
||||||
model.addAttribute("loginUserRoles", loginUser.getRoles());
|
model.addAttribute("loginUserRoles", loginUser.getRole());
|
||||||
});
|
});
|
||||||
|
|
||||||
return "home";
|
return "home";
|
||||||
|
|||||||
@@ -235,19 +235,18 @@
|
|||||||
ajaxUtil._ajaxMethod(
|
ajaxUtil._ajaxMethod(
|
||||||
'/api/settings/admin/create',
|
'/api/settings/admin/create',
|
||||||
JSON.stringify(dataOj),
|
JSON.stringify(dataOj),
|
||||||
function(response) { // 성공
|
function(response) {
|
||||||
alert("등록이 완료되었습니다.");
|
|
||||||
location.href = '/settings/admins';
|
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
if(code == 422) alert(rstData.responseText);
|
if(code === 422) alert(rstData.responseText);
|
||||||
if(code == 200 ){
|
if(code === 200 ){
|
||||||
alert("등록이 완료되었습니다.");
|
alert("등록이 완료되었습니다.");
|
||||||
location.href = '/settings/admins';
|
location.href = '/settings/admins';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'post',
|
'post',
|
||||||
'json'
|
'json',
|
||||||
|
{ handle422Type: 'alert' }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -96,13 +96,12 @@
|
|||||||
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
|
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
|
||||||
type="checkbox"/></label>
|
type="checkbox"/></label>
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">아이디</a></th>
|
<th scope="col">아이디</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">이름</a></th>
|
<th scope="col">이름</th>
|
||||||
<th class="text-secondary" scope="col">권한</th></th>
|
<th scope="col">권한</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">실사</a></th>
|
<th scope="col">실사</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="accountDisabled" href="#">계정사용여부</a></th>
|
<th scope="col">계정사용여부</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">생성일</a>
|
<th scope="col">생성일</th>
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -166,12 +165,9 @@
|
|||||||
f.searchDisabled.value = '';
|
f.searchDisabled.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 수정페이지 이동
|
|
||||||
function goUpdate(adminId) {
|
function goUpdate(adminId) {
|
||||||
const f = document.adminParamForm;
|
location.href = '/settings/admins/update/' + adminId; // 쿼리 파라미터 없이 이동
|
||||||
f.action = '/settings/admins/update/' + adminId;
|
|
||||||
f.method = 'get';
|
|
||||||
f.submit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 체크박스 선택/해제
|
// 체크박스 선택/해제
|
||||||
|
|||||||
@@ -6,28 +6,34 @@
|
|||||||
<form
|
<form
|
||||||
method="post"
|
method="post"
|
||||||
th:action="${'/settings/admins/update/' + bindingVO.id}"
|
th:action="${'/settings/admins/update/' + bindingVO.id}"
|
||||||
th:object="${bindingVO}">
|
th:object="${bindingVO}"
|
||||||
|
name="adminUpdateForm"
|
||||||
|
onsubmit="event.preventDefault(); updateAdmin(); return false;">
|
||||||
<div class="content-inner">
|
<div class="content-inner">
|
||||||
<input type="hidden" name="seq" th:field="*{seq}"/>
|
<input type="hidden" name="seq" th:field="*{seq}"/>
|
||||||
|
|
||||||
<table class="type-form">
|
<table class="type-form">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th> <label for="roleIds">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th> <label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="d-flex">
|
||||||
<select class="select-list" id="roleIds"
|
<div class="component-input">
|
||||||
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
<div class="component-select">
|
||||||
th:field="*{roleIds}"
|
<select class="select-list" id="roleId"
|
||||||
onchange="onRoleChange(this);">
|
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
|
||||||
<option value="">선택</option>
|
th:field="*{roleId}"
|
||||||
<option th:each="role : ${roles}" th:text="${role.description}"
|
onchange="onRoleChange(this);">
|
||||||
th:value="${role.id}"></option>
|
<option value="">선택</option>
|
||||||
</select>
|
<option th:each="role : ${roles}" th:text="${role.description}"
|
||||||
</div>
|
th:value="${role.id}"></option>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{roleIds}"
|
</select>
|
||||||
th:if="${#fields.hasErrors('roleIds')}">
|
</div>
|
||||||
에러 메세지
|
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
|
||||||
|
th:if="${#fields.hasErrors('roleId')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -40,24 +46,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th><label for="password">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="updatePassword">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input id="password" placeholder="암호를 변경하고 싶다면 입력하세요"
|
<input id="updatePassword" placeholder="암호를 변경하고 싶다면 입력하세요"
|
||||||
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
|
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
|
||||||
th:field="*{updatePassword}"
|
th:field="*{updatePassword}"
|
||||||
type="password"/>
|
type="password"/>
|
||||||
|
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
|
||||||
|
th:if="${#fields.hasErrors('updatePassword')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
|
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
|
||||||
th:if="${#fields.hasErrors('updatePassword')}">
|
|
||||||
에러 메세지
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="researcherArea"
|
<tr class="researcherArea"
|
||||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
@@ -83,25 +90,28 @@
|
|||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="number" id="phone1" name="phone1" placeholder=""
|
<input type="number" id="phone1" name="phone1" placeholder=""
|
||||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(4, 8) : ''}">
|
th:value="${bindingVO.phone1 != null ? bindingVO.phone1 : ''}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="invalid-feedback fw-bold"
|
||||||
|
th:if="${#fields.hasErrors('phone1')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="number" id="phone2" name="phone2" placeholder=""
|
<input type="number" id="phone2" name="phone2" placeholder=""
|
||||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(9, 13) : ''}">
|
th:value="${bindingVO.phone2 != null ? bindingVO.phone2 : ''}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="invalid-feedback fw-bold"
|
||||||
|
th:if="${#fields.hasErrors('phone2')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="invalid-feedback fw-bold"
|
|
||||||
th:if="${#fields.hasErrors('phone')}">
|
|
||||||
에러 메세지
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="phone" id="phone" th:field="*{phone}"/>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="regionMainCodeArea"
|
<tr class="regionMainCodeArea"
|
||||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_ADMIN')} ? 'd-none'">
|
||||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
@@ -128,16 +138,16 @@
|
|||||||
<label for="inlineRadio1" class="radio-inner">
|
<label for="inlineRadio1" class="radio-inner">
|
||||||
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
|
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
|
||||||
<span class="radio-item">
|
<span class="radio-item">
|
||||||
<span class="radio-txt">미사용</span>
|
<span class="radio-txt">미사용</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<label for="inlineRadio2" class="radio-inner">
|
<label for="inlineRadio2" class="radio-inner">
|
||||||
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
|
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
|
||||||
<span class="radio-item">
|
<span class="radio-item">
|
||||||
<span class="radio-txt">사용</span>
|
<span class="radio-txt">사용</span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
|
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
|
||||||
@@ -148,6 +158,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- <div th:replace="common/components :: auditArea"></div>-->
|
<!-- <div th:replace="common/components :: auditArea"></div>-->
|
||||||
|
|
||||||
<div class="component-btns bottom-btn-group">
|
<div class="component-btns bottom-btn-group">
|
||||||
@@ -155,12 +166,13 @@
|
|||||||
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
|
||||||
<span class="btn-txt">목록</span>
|
<span class="btn-txt">목록</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="submit" class="btn btn-primary">
|
<button type="button" class="btn btn-primary" onclick="updateAdmin();">
|
||||||
<span class="btn-txt">저장</span>
|
<span class="btn-txt">저장</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
||||||
@@ -185,18 +197,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(() => {
|
||||||
showAudit([[${bindingVO.id}]], [[${bindingVO.createdBy}]],
|
|
||||||
[[${#temporals.format(bindingVO.createdAt, "yyyy-MM-dd'T'HH:mm:ss")}]],
|
|
||||||
[[${bindingVO.updatedBy}]],
|
|
||||||
[[${#temporals.format(bindingVO.updatedAt, "yyyy-MM-dd'T'HH:mm:ss")}]]);
|
|
||||||
|
|
||||||
// 초기 로드 시 roleIds에 따라 regionMainCodeArea 표시/숨김
|
// 초기 로드 시 roleId에 따라 regionMainCodeArea 표시/숨김
|
||||||
const roleSelect = document.getElementById('roleIds');
|
const roleSelect = document.getElementById('roleId');
|
||||||
if (roleSelect) {
|
if (roleSelect) {
|
||||||
onRoleChange(roleSelect);
|
onRoleChange(roleSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('form').on('submit', function() {
|
/* $('form').on('submit', function() {
|
||||||
const phone1 = $('#phone1').val();
|
const phone1 = $('#phone1').val();
|
||||||
const phone2 = $('#phone2').val();
|
const phone2 = $('#phone2').val();
|
||||||
if (phone1 && phone2) {
|
if (phone1 && phone2) {
|
||||||
@@ -204,7 +212,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$('#phone').val('');
|
$('#phone').val('');
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -215,6 +223,29 @@
|
|||||||
$('.researcherArea').toggle(idResearcher);
|
$('.researcherArea').toggle(idResearcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateAdmin = () => {
|
||||||
|
|
||||||
|
const f = document.adminUpdateForm;
|
||||||
|
let dataOj = $(f).serializeObject();
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/settings/admin/update',
|
||||||
|
JSON.stringify(dataOj),
|
||||||
|
function(response) {
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
if(code === 422) alert(rstData.responseText);
|
||||||
|
if(code === 200 ){
|
||||||
|
alert("수정이 완료되었습니다.");
|
||||||
|
location.href = '/settings/admins';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'post',
|
||||||
|
'json',
|
||||||
|
{ handle422Type: 'alert' }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class AdminViewDao implements AdminViewPortOut {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public Optional<AdminView> connect(String id) {
|
public Optional<AdminView> connect(String id) {
|
||||||
return mapper.findById(id).map(admin -> {
|
return mapper.findById(id).map(admin -> {
|
||||||
admin.setRoles(mapper.findRoleHasPrivilegesByAdminId(admin.getSeq()));
|
admin.setRole(mapper.findRoleHasPrivilegesByAdminId(admin.getSeq()));
|
||||||
return admin;
|
return admin;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface AdminViewMapper {
|
public interface AdminViewMapper {
|
||||||
Optional<AdminView> findById(String id);
|
Optional<AdminView> findById(String id);
|
||||||
List<CoreRole> findRoleHasPrivilegesByAdminId(Long id);
|
CoreRole findRoleHasPrivilegesByAdminId(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ public class AdminView implements Serializable {
|
|||||||
private String createdBy;
|
private String createdBy;
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private List<CoreRole> roles;
|
private CoreRole role;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user