Skip to content
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
20 changes: 8 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy to EC2 with Docker

on:
push:
branches: [main]
branches: [main, fix/#25-회원로직버그]
pull_request:
branches: [main]

Expand All @@ -14,14 +14,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Copy files to EC2
uses: appleboy/scp-action@v0.1.3
with:
host: ${{ secrets.EC2_HOST }}
username: ec2-user
key: ${{ secrets.EC2_KEY }}
source: "."
target: "/home/ec2-user/app"
- name: Build JAR
run: ./gradlew clean build -x test

- name: Copy jar to Docker context
run: cp build/libs/TagCafe-0.0.1-SNAPSHOT.jar .

- name: SSH into EC2 and deploy
uses: appleboy/ssh-action@v0.1.10
Expand All @@ -31,7 +28,6 @@ jobs:
key: ${{ secrets.EC2_KEY }}
script: |
cd /home/ec2-user/app
chmod +x gradlew
./gradlew clean build -x test
docker-compose down
docker-compose up --build -d
docker-compose build --no-cache
docker-compose up -d
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public RedirectView kakaoCallback(@RequestParam(name="code") String code) {

String kakaoNickname = profile != null ? (String) profile.get("nickname") : "Unknown";
String email = (String) kakaoAccount.get("email");
if (email == null || email.isBlank()) {
logger.error("❌ 이메일 정보가 없습니다. 카카오 계정에 이메일이 등록되어 있는지 확인하세요.");
return new RedirectView("https://tagcafe.site/error?message=이메일 정보를 가져올 수 없습니다.");
}

logger.info("✅ 카카오 로그인 성공! 닉네임: {}, 이메일: {}", kakaoNickname, email);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.Minjin.TagCafe.dto.NicknameRequest;
import com.Minjin.TagCafe.entity.User;
import com.Minjin.TagCafe.repository.SavedCafeRepository;
import com.Minjin.TagCafe.repository.UserRepository;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand All @@ -15,6 +16,8 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
Expand All @@ -26,6 +29,7 @@
@CrossOrigin(origins = "https://tagcafe.site", allowCredentials = "true")
public class UserController {
private final UserRepository userRepository;
private final SavedCafeRepository savedCafeRepository;

@Value("${kakao.client.id}")
private String kakaoClientId;
Expand Down Expand Up @@ -53,6 +57,7 @@ public ResponseEntity<Map<String, String>> deleteUser(@RequestParam("email") Str
Optional<User> userOptional = userRepository.findByEmail(email);

if (userOptional.isPresent()) {
savedCafeRepository.deleteAll(savedCafeRepository.findByUser(userOptional.get()));
userRepository.delete(userOptional.get());

// ✅ 세션 무효화
Expand All @@ -75,7 +80,8 @@ public ResponseEntity<Map<String, String>> deleteUser(@RequestParam("email") Str
// ✅ 카카오 로그아웃 URL 반환
Map<String, String> response = new HashMap<>();
response.put("message", "회원 탈퇴 성공");
response.put("logoutUrl", "https://kauth.kakao.com/oauth/logout?client_id=" + kakaoClientId + "&logout_redirect_uri=https://tagcafe.site");
String encodedRedirectUri = URLEncoder.encode("https://tagcafe.site", StandardCharsets.UTF_8);
response.put("logoutUrl", "https://kauth.kakao.com/oauth/logout?client_id=" + kakaoClientId + "&logout_redirect_uri=" + encodedRedirectUri);

return ResponseEntity.ok(response);
} else {
Expand Down