Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 회원가입 버그 수정 #78

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading