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
8 changes: 4 additions & 4 deletions src/main/webapp/WEB-INF/views/lobby.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
<!-- (디자인용) 기본 로그인 UI -->
<div class="field">
<label>이메일</label>
<input type="text" placeholder="이메일" />
<input id="login-email" type="text" placeholder="이메일" />
</div>

<div class="field">
<label>비밀번호</label>
<input type="password" placeholder="비밀번호" />
<input id="login-password" type="password" placeholder="비밀번호" />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

HTML 속성에 구문 오류가 있습니다.

action 속성 값에 중복된 따옴표가 있습니다: action="${CTX}/room/enter"" → 따옴표가 두 개 연속으로 나타납니다.

🔎 구문 오류 수정
-          <form class="enter-room-form" action="${CTX}/room/enter"" method="post">
+          <form class="enter-room-form" action="${CTX}/room/enter" method="post">

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/webapp/WEB-INF/views/lobby.jsp around line 98, the HTML has a syntax
error: the action attribute contains a duplicated double-quote
(`action="${CTX}/room/enter""`). Remove the extra quote so the attribute is
properly quoted (e.g., action="${CTX}/room/enter"), and scan the surrounding tag
to ensure there are no other stray or mismatched quotes in the same element.


<button type="button" class="btn-primary" onclick="alert('카카오 로그인으로 진행해주세요!')">
<button type="button" class="btn-primary" id="btn-login">
로그인
</button>

Expand All @@ -108,7 +108,7 @@
</a>

<p class="signup-hint">
계정이 없으신가요? <a href="#">회원가입</a>
계정이 없으신가요? <a href="${pageContext.request.contextPath}/signup2">회원가입</a>
</p>
</c:when>

Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%
// 서버 시작 시 자동으로 로비로 리다이렉트
response.sendRedirect(request.getContextPath() + "/lobby");
%>
44 changes: 44 additions & 0 deletions src/main/webapp/static/lobby/lobby.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,49 @@
try { lobbyWs?.close(); } catch (_) {}
});

// 일반 로그인 처리
const btnLogin = document.getElementById("btn-login");
const emailInput = document.getElementById("login-email");
const passwordInput = document.getElementById("login-password");

if (btnLogin && emailInput && passwordInput) {
btnLogin.addEventListener("click", async () => {
const email = emailInput.value.trim();
const password = passwordInput.value.trim();

if (!email || !password) {
alert("이메일과 비밀번호를 입력해주세요.");
return;
}

try {
const response = await fetch(CTX + "/noamlLogin", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email, password })
});

const data = await response.json();

if (response.ok && data.accessToken) {
alert("로그인 성공!");
location.reload();
} else {
alert(data.message || "로그인 실패");
}
} catch (error) {
console.error("로그인 오류:", error);
alert("로그인 중 오류가 발생했습니다.");
}
});

// Enter 키로 로그인
passwordInput.addEventListener("keypress", (e) => {
if (e.key === "Enter") {
btnLogin.click();
}
});
}

connectLobby();
})();