|
@@ -110,18 +110,47 @@ public class TbUserInfrService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 클라이언트 단에서 암호화 한값을 다시 복호화
|
|
|
+ * @param pswd
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String encoding(String pswd) {
|
|
|
+ return pswd;
|
|
|
+ }
|
|
|
+
|
|
|
// 운영자 비밀번호 변경
|
|
|
@Transactional
|
|
|
public TbUserInfrDto updatePswdById(String id, TbUserInfrDto.TbUserPswdUpdReq req) throws NoSuchElementException {
|
|
|
|
|
|
TbUserInfr entity = requireOne(id);
|
|
|
- if (!entity.getPwd().equals(req.getOldPwd())) {
|
|
|
- throw new NoSuchElementException("데이터가 존재하지 않습니다: " + id);
|
|
|
+ /**
|
|
|
+ * 클라이언트 단에서 비밀번호 암호화 한 경우
|
|
|
+ */
|
|
|
+ String orgPswd = encoding(req.getPwd());
|
|
|
+
|
|
|
+ if (req.getOldPwd().equals(orgPswd)) {
|
|
|
+ // 비밀번호를 변경하지 않은 것임.(getPwd() => 암화화된 비밀번호가 들어가 있음)
|
|
|
+ throw new NoSuchElementException("현재 비빌번호와 같습니다[1]: " + id);
|
|
|
}
|
|
|
- if (entity.getPwd().equals(req.getPwd())) {
|
|
|
- throw new NoSuchElementException("현재 비빌번호와 같습니다: " + id);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 입력한 비밀번호를 암호화 한다.
|
|
|
+ */
|
|
|
+ String pswd = this.repo.getCryptoEncrypt(orgPswd);
|
|
|
+ if (entity.getPwd().equals(pswd)) {
|
|
|
+ // 입력한 비밀번호 암호화한 값이 이전 비밀번호 암호화 내용과 같음
|
|
|
+ throw new NoSuchElementException("현재 비빌번호와 같습니다[2]: " + id);
|
|
|
}
|
|
|
- entity.updatePswd(req);
|
|
|
+
|
|
|
+// if (!entity.getPwd().equals(req.getOldPwd())) {
|
|
|
+// throw new NoSuchElementException("데이터가 존재하지 않습니다: " + id);
|
|
|
+// }
|
|
|
+// if (entity.getPwd().equals(req.getPwd())) {
|
|
|
+// throw new NoSuchElementException("현재 비빌번호와 같습니다: " + id);
|
|
|
+// }
|
|
|
+
|
|
|
+ entity.updatePswd(pswd);
|
|
|
this.repo.save(entity);
|
|
|
return entity.toDto();
|
|
|
}
|