map으로 변경
This commit is contained in:
parent
d8f36fbf17
commit
8fa323414a
@ -16,6 +16,7 @@ package io.company.localhost.common.security.handler;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.company.localhost.common.dto.ApiResponse;
|
import io.company.localhost.common.dto.ApiResponse;
|
||||||
|
import io.company.localhost.common.dto.MapDto;
|
||||||
import io.company.localhost.common.security.service.TokenService;
|
import io.company.localhost.common.security.service.TokenService;
|
||||||
import io.company.localhost.service.NetmemberService;
|
import io.company.localhost.service.NetmemberService;
|
||||||
import io.company.localhost.vo.MemberVo;
|
import io.company.localhost.vo.MemberVo;
|
||||||
@ -33,6 +34,8 @@ import org.springframework.security.web.authentication.AuthenticationSuccessHand
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component("successHandler")
|
@Component("successHandler")
|
||||||
@ -63,7 +66,10 @@ public class MemberAuthSuccessHandler implements AuthenticationSuccessHandler {
|
|||||||
String loginToken = tokenService.generateToken(username, "login");
|
String loginToken = tokenService.generateToken(username, "login");
|
||||||
|
|
||||||
// DB에 저장
|
// DB에 저장
|
||||||
netmemberService.updateMemberToken(username, loginToken);
|
MapDto map = new MapDto();
|
||||||
|
map.put("id", username);
|
||||||
|
map.put("token", loginToken);
|
||||||
|
netmemberService.updateMemberToken(map);
|
||||||
|
|
||||||
response.setStatus(HttpStatus.OK.value());
|
response.setStatus(HttpStatus.OK.value());
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
|||||||
@ -26,13 +26,15 @@ public interface NetmemberMapper {
|
|||||||
|
|
||||||
MemberVo findByLoginId(String id);
|
MemberVo findByLoginId(String id);
|
||||||
|
|
||||||
int updateMemberToken(String id, String token);
|
int updateMemberToken(MapDto map);
|
||||||
|
|
||||||
int insertMember(MapDto map);
|
int insertMember(MapDto map);
|
||||||
|
|
||||||
int selectCheckId(String memberIds);
|
int selectCheckId(String memberIds);
|
||||||
|
|
||||||
int selectPwReset(MapDto map);
|
int selectPwReset(MapDto map);
|
||||||
|
|
||||||
|
String selectPassword(String id);
|
||||||
|
|
||||||
int updatePassword(MapDto map);
|
int updatePassword(MapDto map);
|
||||||
|
|
||||||
|
|||||||
@ -96,8 +96,8 @@ public class NetmemberService {
|
|||||||
* @param id, token
|
* @param id, token
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void updateMemberToken(String id, String token) {
|
public void updateMemberToken(MapDto map) {
|
||||||
memberMapper.updateMemberToken(id, token);
|
memberMapper.updateMemberToken(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,6 +109,20 @@ public class NetmemberService {
|
|||||||
public boolean selectPwReset(MapDto map) {
|
public boolean selectPwReset(MapDto map) {
|
||||||
return memberMapper.selectPwReset(map) > 0;
|
return memberMapper.selectPwReset(map) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 기존 비밀번호 체크
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean selectPassword(MapDto map) {
|
||||||
|
String currentPassword = memberMapper.selectPassword(map.getString("id"));
|
||||||
|
String newPassword = map.getString("password");
|
||||||
|
|
||||||
|
// 기존 비밀번호, 새 비밀번호 같은지 확인
|
||||||
|
return !passwordEncoder.matches(newPassword, currentPassword);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 비밀번호 재설정
|
* 비밀번호 재설정
|
||||||
|
|||||||
@ -105,6 +105,13 @@
|
|||||||
AND MEMBERPWR = #{pwhintRes}
|
AND MEMBERPWR = #{pwhintRes}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 비밀번호 재설정 기존 비밀번호 체크 -->
|
||||||
|
<select id="selectPassword">
|
||||||
|
SELECT MEMBERPWD
|
||||||
|
FROM netmember
|
||||||
|
WHERE MEMBERIDS = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 비밀번호 재설정 -->
|
<!-- 비밀번호 재설정 -->
|
||||||
<update id="updatePassword">
|
<update id="updatePassword">
|
||||||
UPDATE netmember
|
UPDATE netmember
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user