비밀번호 재설정
This commit is contained in:
parent
7b32de158b
commit
74272f3233
@ -41,6 +41,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
||||
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@ -88,6 +89,19 @@ public class UserController {
|
||||
return ApiResponse.ok(MbtiList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀번호 힌트 목록 조회
|
||||
*
|
||||
* @return ApiResponse<List<MapDto>>
|
||||
*
|
||||
*/
|
||||
@ParameterCheck
|
||||
@GetMapping("/pwhint")
|
||||
public ApiResponse<List<MapDto>> getPwhintList() {
|
||||
List<MapDto> PwhintList = commoncodservice.getPwhintList();
|
||||
return ApiResponse.ok(PwhintList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입
|
||||
*
|
||||
@ -107,7 +121,7 @@ public class UserController {
|
||||
*
|
||||
* @param memberIds
|
||||
* @return ApiResponse<Boolean>
|
||||
* @throws IllegalArgumentException
|
||||
*
|
||||
*/
|
||||
@GetMapping("/checkId")
|
||||
public ApiResponse<Boolean> selectCheckId(@RequestParam String memberIds) {
|
||||
@ -115,6 +129,42 @@ public class UserController {
|
||||
return ApiResponse.ok(!isDuplicate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그인 여부 체크
|
||||
*
|
||||
* @return ApiResponse<Boolean>
|
||||
*/
|
||||
@GetMapping("/isLogin")
|
||||
public ApiResponse<Boolean> checkLogin() {
|
||||
boolean isLoggedIn = AuthUtil.isLoggedIn();
|
||||
return ApiResponse.ok(isLoggedIn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀번호 재설정 member 체크
|
||||
*
|
||||
* @param map
|
||||
* @return ApiResponse<Boolean>
|
||||
*
|
||||
*/
|
||||
@PostMapping("/pwReset")
|
||||
public ApiResponse<Boolean> selectPwReset(@ReqMap MapDto map) {
|
||||
boolean isPwReset = netmemberservice.selectPwReset(map);
|
||||
return ApiResponse.ok(isPwReset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀번호 재설정
|
||||
*
|
||||
* @param map
|
||||
* @return ApiResponse<Boolean>
|
||||
*
|
||||
*/
|
||||
@PatchMapping("/pwNew")
|
||||
public ApiResponse<Boolean> updatePassword(@ReqMap MapDto map) {
|
||||
boolean isPwNew = netmemberservice.updatePassword(map);
|
||||
return ApiResponse.ok(isPwNew);
|
||||
}
|
||||
|
||||
// security 인증 체크
|
||||
@GetMapping("userInfo")
|
||||
@ -172,9 +222,6 @@ public class UserController {
|
||||
return ApiResponse.ok(remember);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 로그아웃
|
||||
@Guest
|
||||
@GetMapping("/logout")
|
||||
@ -198,6 +245,7 @@ public class UserController {
|
||||
|
||||
return ApiResponse.ok(returnMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사원 목록 전체 조회
|
||||
*
|
||||
@ -211,8 +259,6 @@ public class UserController {
|
||||
return ApiResponse.ok(allUserList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Guest
|
||||
@GetMapping("get1")
|
||||
public ApiResponse<?> getAuthTest1() {
|
||||
|
||||
@ -32,5 +32,10 @@ public interface NetmemberMapper {
|
||||
|
||||
int selectCheckId(String memberIds);
|
||||
|
||||
int selectPwReset(MapDto map);
|
||||
|
||||
int updatePassword(MapDto map);
|
||||
|
||||
List<MapDto> getallUserList();
|
||||
|
||||
}
|
||||
|
||||
@ -91,9 +91,37 @@ public class NetmemberService {
|
||||
return memberMapper.getallUserList();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
/**
|
||||
* 로그인 토큰
|
||||
*
|
||||
* @param id, token
|
||||
* @return
|
||||
*/
|
||||
public void updateMemberToken(String id, String token) {
|
||||
memberMapper.updateMemberToken(id, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀번호 재설정 member 체크
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public boolean selectPwReset(MapDto map) {
|
||||
return memberMapper.selectPwReset(map) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀번호 재설정
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public boolean updatePassword(MapDto map) {
|
||||
String encodedPassword = passwordEncoder.encode(map.getString("password"));
|
||||
map.put("password", encodedPassword);
|
||||
System.out.println("암호화된 비밀번호: " + encodedPassword);
|
||||
return memberMapper.updatePassword(map) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -95,6 +95,23 @@
|
||||
WHERE MEMBERIDS = #{memberIds}
|
||||
</select>
|
||||
|
||||
<!-- 비밀번호 재설정 member 체크 -->
|
||||
<select id="selectPwReset" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM netmember
|
||||
WHERE MEMBERIDS = #{id}
|
||||
AND MEMBERBTH = #{birth}
|
||||
AND MEMBERPWH = #{pwhint}
|
||||
AND MEMBERPWR = #{pwhintRes}
|
||||
</select>
|
||||
|
||||
<!-- 비밀번호 재설정 -->
|
||||
<update id="updatePassword">
|
||||
UPDATE netmember
|
||||
SET MEMBERPWD = #{password}
|
||||
WHERE MEMBERIDS = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getallUserList" resultType="Map">
|
||||
SELECT *
|
||||
FROM
|
||||
|
||||
Loading…
Reference in New Issue
Block a user