ChatSystem/public/register.html
2026-01-16 15:40:38 +09:00

151 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>회원가입 - IDC 상담 채널</title>
<link href="https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;600&display=swap" rel="stylesheet">
<style>
:root {
--skype-blue: #0078d4;
--bg-light: #f3f2f1;
--text-main: #201f1e;
}
body {
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: var(--bg-light);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: var(--text-main);
}
.register-container {
background: white;
padding: 40px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
text-align: center;
}
h2 {
margin-bottom: 30px;
color: var(--skype-blue);
}
.form-group {
margin-bottom: 20px;
text-align: left;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
font-size: 14px;
}
input {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
font-size: 14px;
}
input:focus {
outline: none;
border-color: var(--skype-blue);
}
button {
width: 100%;
padding: 14px;
background: var(--skype-blue);
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
margin-top: 10px;
}
button:hover {
background: #005a9e;
}
.footer-links {
margin-top: 25px;
font-size: 14px;
color: #666;
}
.footer-links a {
color: var(--skype-blue);
text-decoration: none;
}
</style>
</head>
<body>
<div class="register-container">
<h2>상담 서비스 회원가입</h2>
<div class="form-group">
<label for="reg-id">아이디</label>
<input type="text" id="reg-id" placeholder="사용할 아이디를 입력하세요">
</div>
<div class="form-group">
<label for="reg-pw">비밀번호</label>
<input type="password" id="reg-pw" placeholder="비밀번호를 입력하세요">
</div>
<button id="register-btn">회원가입 하기</button>
<div class="footer-links">
이미 계정이 있으신가요? <a href="/chat">로그인으로 돌아가기</a>
</div>
</div>
<script>
document.getElementById('register-btn').addEventListener('click', async () => {
const username = document.getElementById('reg-id').value.trim();
const password = document.getElementById('reg-pw').value.trim();
if (!username || !password) {
alert('모든 필드를 입력해주세요.');
return;
}
try {
const response = await fetch('/api/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
});
const result = await response.json();
if (result.success) {
alert('회원가입이 완료되었습니다! 로그인 페이지로 이동합니다.');
window.location.href = '/chat';
} else {
alert('실패: ' + result.message);
}
} catch (err) {
console.error('API Error:', err);
alert('서버와 통신 중 오류가 발생했습니다.');
}
});
</script>
</body>
</html>