pendingInvitation =
userInvitationRepository.findFirstByInvitationEmailAndStatus(
user.getLoginId(), InvitationStatus.PENDING);
if (pendingInvitation.isPresent()) {
- // 만료되지 않은 초대가 있으면 자동으로 초대 수락 페이지로 이동
UserInvitation invitation = pendingInvitation.get();
if (invitation.getExpiresOn().isAfter(LocalDateTime.now())) {
- response.sendRedirect(contextPath + "/signup/decision?invitation=" + invitation.getToken());
- return;
+ // 세션에 초대 정보 저장 (메인 페이지에서 팝업으로 표시)
+ session.setAttribute("pendingInvitation", true);
+ session.setAttribute("pendingInvitationToken", invitation.getToken());
+ // orgId로 기관명 조회
+ String orgName = portalOrgRepository.findById(invitation.getOrgId())
+ .map(PortalOrg::getOrgName)
+ .orElse("알 수 없는 기관");
+ session.setAttribute("pendingInvitationOrgName", orgName);
}
}
}
diff --git a/src/main/resources/templates/views/apps/login/login.html b/src/main/resources/templates/views/apps/login/login.html
index 9b6ccbc..fa154a7 100644
--- a/src/main/resources/templates/views/apps/login/login.html
+++ b/src/main/resources/templates/views/apps/login/login.html
@@ -70,13 +70,6 @@
회원가입
-
- |
-
-
-
- 초대를 받으셨나요?
-
diff --git a/src/main/resources/templates/views/apps/main/index.html b/src/main/resources/templates/views/apps/main/index.html
index 30036cd..e78150d 100644
--- a/src/main/resources/templates/views/apps/main/index.html
+++ b/src/main/resources/templates/views/apps/main/index.html
@@ -299,6 +299,20 @@
customPopups.hideAlert('#customAlert');
window.location.href = redirectUrl;
});
+ return; // 다른 체크 중단
+ }
+
+ // 초대 대기 확인 (로그인할 때마다 표시)
+ const pendingInvitation = [[${session.pendingInvitation}]];
+ if (pendingInvitation) {
+ const invitationToken = /*[[${session.pendingInvitationToken}]]*/ '';
+ const orgName = /*[[${session.pendingInvitationOrgName}]]*/ '';
+
+ customPopups.showConfirm(`${orgName}에서 초대가 도착했습니다.
초대를 확인하시겠습니까?`, function (selection) {
+ if (selection) {
+ window.location.href = '/signup/decision?invitation=' + invitationToken;
+ }
+ });
}
});