[] init project_Front

This commit is contained in:
김선규 2024-07-11 16:34:40 +09:00
commit 5ee6f5666e
8 changed files with 276 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.DS_Store
/resource
/private

1
README.md Normal file
View File

@ -0,0 +1 @@
README.md

14
admin.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Page</title>
<!-- <link rel="stylesheet" href="/styles.css"> -->
</head>
<body>
<h1>Admin Page</h1>
<p>Welcome, Administrator!</p>
</body>
</html>

163
login/login.css Normal file
View File

@ -0,0 +1,163 @@
@import url('resource/font/fonts.css');
body {
font-family: 'NPS Regular', Arial, sans-serif;
background-color: #B2CCF0; /* whiteSora 배경색 */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
padding: 0 20px;
box-sizing: border-box; /* 패딩을 포함하도록 설정 */
}
.logo-container {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
max-width: 600px;
}
.login-container {
width: 100%;
padding: 20px;
background: white;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
border-radius: 8px;
text-align: center;
background-color: #FFF; /* 흰색 배경 */
border: 2px solid #1F2C59; /* deepBlue 테두리 */
box-sizing: border-box;
z-index: 1; /* 로그인 컨테이너가 로고 위에 있도록 설정 */
}
h2 {
margin-bottom: 20px;
font-family: 'NPS Bold', Arial, sans-serif;
color: #1F2C59; /* deepBlue 색상 */
}
.input-group {
margin-bottom: 15px;
text-align: left;
}
.input-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #1F2C59; /* deepBlue 색상 */
}
.input-group input {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 20px; /* 폰트 크기 조정 */
}
.button-group {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px; /* 버튼 그룹과 입력 필드 사이의 여백 */
}
.register {
background: none; /* 배경 제거 */
border: none; /* 테두리 제거 */
color: #3678F1; /* 텍스트 색상 */
text-decoration: underline; /* 밑줄 추가 */
cursor: pointer; /* 마우스 포인터 */
font-size: 16px; /* 폰트 크기 */
font-family: 'NPS Bold', Arial, sans-serif; /* 폰트 패밀리 */
padding: 0; /* 패딩 제거 */
}
.login {
padding: 10px 15px;
background-color: #3678F1; /* radeka 색상 */
color: white;
border: none;
cursor: pointer;
border-radius: 4px;
font-size: 16px;
font-family: 'NPS Bold', Arial, sans-serif;
}
.login:hover {
background-color: #1F2C59; /* deepBlue 색상 */
}
.register:hover {
color: red; /* 텍스트 색상 */
}
.logo {
max-width: 1024px; /* 로고 크기를 조정 */
height: auto;
position: absolute; /* 로고를 인디케이터 뒤에 위치시키기 위해 position 속성 추가 */
z-index: 0; /* 로그인 컨테이너 뒤에 위치하도록 설정 */
filter: blur(4px); /* 블러 효과 추가 */
opacity: 0.5; /* 투명도 설정 (0.0 ~ 1.0) */
}
/* 인디케이터 백그라운드 스타일 */
.indicator-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999; /* 최상위 레이어 */
}
/* 인디케이터 스타일 */
.indicator {
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3678F1; /* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}
/* 인디케이터 애니메이션 */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 미디어 쿼리 */
@media (max-width: 600) {
body {
padding: 0 10px; /* 작은 화면에서는 양쪽 여백을 줄임 */
}
.login-container {
width: 100%;
padding: 15px; /* 작은 화면에서 패딩 조정 */
}
h2 {
font-size: 1.5em;
}
.login, .register {
font-size: 14px;
padding: 8px 12px;
}
}

39
login/login.html Normal file
View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Login</title>
<link rel="stylesheet" href="./login.css">
<link rel="stylesheet" href="./resource/font/fonts.css">
</head>
<body>
<div class="logo-container">
<img src="/resource/image/High_NoLine_team-icon.png" alt="Logo" class="logo">
<div class="login-container">
<h2>로그인</h2>
<form id="loginForm">
<div class="input-group">
<label for="username">ID</label>
<input type="text" id="username" name="username" required>
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<div class="button-group">
<button type="button" class="register">가입하기</button>
<button type="submit" class="login">로그인</button>
</div>
</form>
</div>
</div>
<div class="indicator-background" id="indicator-background" style="display: none;">
<div class="indicator"></div>
</div>
<script src="/login.js"></script>
</body>
</html>

54
login/login.js Normal file
View File

@ -0,0 +1,54 @@
document.getElementById('loginForm').addEventListener('submit', function(event) {
event.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
const indicatorBackground = document.getElementById('indicator-background');
indicatorBackground.style.display = 'flex';
fetch('/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ username, password })
})
.then(response => response.json())
.then(data => {
indicatorBackground.style.display = 'none';
if (data.success) {
// alert('로그인이 성공했습니다!');
fetch(`/getGroups?username=${username}`)
.then(response => response.json())
.then(groupData => {
console.log('그룹 정보:', groupData);
// 그룹 데이터에서 name이 'administrators'인 그룹이 있는지 확인
const isAdmin = groupData.some(group => group.name === 'administrators');
if (isAdmin) {
alert('관리자 계정으로 접속하였습니다.');
window.location.href = '/admin'; // admin 페이지로 리다이렉트
} else {
alert('로그인에 성공하였습니다.');
window.location.href = '/'; // 일반 사용자 페이지로 리다이렉트
}
// 그룹 정보를 웹 페이지에 표시하거나 처리하는 로직 추가
})
.catch(error => {
console.error('그룹 정보를 가져오는 중 오류 발생:', error);
alert('그룹 정보를 가져오는 중 오류가 발생했습니다.');
});
} else {
alert('아이디 또는 비밀번호가 잘못되었습니다.');
}
})
.catch(error => {
console.error('Error:', error);
indicatorBackground.style.display = 'none';
alert('로그인 중 오류가 발생했습니다.');
});
});

0
ls Normal file
View File

0
main.html Normal file
View File