Skip to content

Commit

Permalink
fix: 회원가입 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
birdieHyun committed Dec 15, 2023
1 parent a47e0a9 commit cc1d5e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM openjdk:11-jre-slim

RUN apt-get update && apt-get install -y tzdata
ENV TZ=Asia/Seoul

ARG JAR_FILE=build/libs/Yonsei-Golf-Server-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/yonseigolf/server/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void addInterceptors(InterceptorRegistry registry) {
.addPathPatterns("/users/logout");

registry.addInterceptor(oauthInterceptor)
.addPathPatterns("/users/signIn");
.addPathPatterns("/users/signUp")
.addPathPatterns("/users/signIn");

registry.addInterceptor(loginInterceptor)
.addPathPatterns("/boards/**")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,13 @@ private void invalidateCookie(HttpServletResponse response) {
}

@PostMapping("/users/signUp")
public ResponseEntity<CustomResponse<Void>> signUp(@RequestBody @Validated SignUpUserRequest request, HttpSession session) {
public ResponseEntity<CustomResponse<Void>> signUp(@RequestBody @Validated SignUpUserRequest request, @RequestAttribute Long kakaoId) {

Long kakaoId = (Long) session.getAttribute(SESSION_KAKAO_USER);

if (session.getAttribute("user") != null) {
throw new IllegalArgumentException("[ERROR] 이미 로그인된 상태입니다.");
}
if (kakaoId == null) {
throw new IllegalArgumentException("[ERROR] 카카오 로그인을 먼저 해주세요.");
}

LoggedInUser sessionUser = userService.signUp(request, kakaoId);

session.removeAttribute(SESSION_KAKAO_USER);
session.setAttribute("user", sessionUser);
userService.signUp(request, kakaoId);

return ResponseEntity
.ok()
Expand Down

0 comments on commit cc1d5e7

Please sign in to comment.