1
This commit is contained in:
parent
797a8424a8
commit
0d93e2e806
18
API Login.js
Normal file
18
API Login.js
Normal file
@ -0,0 +1,18 @@
|
||||
const BASE_URL = "http://localhost:3000/api";
|
||||
|
||||
export async function loginRequest(username, password) {
|
||||
try {
|
||||
const response = await fetch(`${BASE_URL}/login`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ username, password })
|
||||
});
|
||||
|
||||
return await response.json();
|
||||
} catch (err) {
|
||||
console.error("API login error:", err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
495
Login.css
495
Login.css
@ -1,205 +1,350 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background: linear-gradient(135deg, #1a0033 0%, #0d001a 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background: linear-gradient(135deg, #1a0033 0%, #0d001a 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#particles {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
#particles {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.particle {
|
||||
position: absolute;
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
}
|
||||
.particle {
|
||||
position: absolute;
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
background: rgba(30, 0, 50, 0.6);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 20px;
|
||||
padding: 50px 40px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
background: rgba(30, 0, 50, 0.6);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 20px;
|
||||
padding: 50px 40px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 2rem;
|
||||
margin-bottom: 40px;
|
||||
background: linear-gradient(90deg, #00d9ff 0%, #ff00ff 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 2rem;
|
||||
margin-bottom: 40px;
|
||||
background: linear-gradient(90deg, #00d9ff 0%, #ff00ff 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 3px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.input-group {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 15px 20px;
|
||||
background: rgba(50, 50, 70, 0.5);
|
||||
border: 2px solid rgba(100, 100, 120, 0.3);
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
transition: all 0.3s ease;
|
||||
outline: none;
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 15px 20px;
|
||||
background: rgba(50, 50, 70, 0.5);
|
||||
border: 2px solid rgba(100, 100, 120, 0.3);
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
transition: all 0.3s ease;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
border-color: #00d9ff;
|
||||
box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
|
||||
}
|
||||
input:focus {
|
||||
border-color: #00d9ff;
|
||||
box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
|
||||
}
|
||||
|
||||
input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
margin-top: 10px;
|
||||
background: linear-gradient(90deg, #00d9ff 0%, #ff00ff 100%);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 5px 25px rgba(0, 217, 255, 0.4);
|
||||
}
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
margin-top: 10px;
|
||||
background: linear-gradient(90deg, #00d9ff 0%, #ff00ff 100%);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 5px 25px rgba(0, 217, 255, 0.4);
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 35px rgba(0, 217, 255, 0.6);
|
||||
}
|
||||
.btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 35px rgba(0, 217, 255, 0.6);
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.register-link {
|
||||
text-align: center;
|
||||
margin-top: 25px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
font-size: 14px;
|
||||
}
|
||||
.register-link {
|
||||
text-align: center;
|
||||
margin-top: 25px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.register-link a {
|
||||
color: #00d9ff;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.register-link a {
|
||||
color: #00d9ff;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.register-link a:hover {
|
||||
color: #ff00ff;
|
||||
text-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
|
||||
}
|
||||
.register-link a:hover {
|
||||
color: #ff00ff;
|
||||
text-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 40px 30px;
|
||||
width: 95%;
|
||||
}
|
||||
/* Custom Modal Styles */
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
backdrop-filter: blur(5px);
|
||||
animation: fadeIn 0.3s ease;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.6rem;
|
||||
letter-spacing: 2px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.modal.show {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 12px 16px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.modal-content {
|
||||
background: linear-gradient(135deg, rgba(30, 0, 50, 0.95) 0%, rgba(50, 0, 80, 0.95) 100%);
|
||||
border: 2px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 20px;
|
||||
padding: 40px 30px;
|
||||
text-align: center;
|
||||
max-width: 400px;
|
||||
width: 90%;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
animation: slideIn 0.3s ease;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 13px;
|
||||
font-size: 16px;
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
.modal-icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
margin: 0 auto 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
.modal-icon.success {
|
||||
background: linear-gradient(135deg, #00d9ff 0%, #00ff88 100%);
|
||||
box-shadow: 0 0 30px rgba(0, 217, 255, 0.6);
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.container {
|
||||
padding: 30px 20px;
|
||||
}
|
||||
.modal-icon.success::before {
|
||||
content: "✓";
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.4rem;
|
||||
letter-spacing: 1.5px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.modal-icon.error {
|
||||
background: linear-gradient(135deg, #ff0080 0%, #ff00ff 100%);
|
||||
box-shadow: 0 0 30px rgba(255, 0, 128, 0.6);
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 10px 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.modal-icon.error::before {
|
||||
content: "✕";
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 12px;
|
||||
font-size: 15px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.modal-content h2 {
|
||||
color: #fff;
|
||||
font-size: 1.8rem;
|
||||
margin-bottom: 15px;
|
||||
background: linear-gradient(90deg, #00d9ff 0%, #ff00ff 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
font-size: 12px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
.modal-content p {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 30px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@media (max-width: 360px) {
|
||||
.container {
|
||||
padding: 25px 15px;
|
||||
}
|
||||
.modal-btn {
|
||||
padding: 12px 50px;
|
||||
background: linear-gradient(90deg, #00d9ff 0%, #ff00ff 100%);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 5px 25px rgba(0, 217, 255, 0.4);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
.modal-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 35px rgba(0, 217, 255, 0.6);
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 10px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.modal-btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.btn {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
transform: translateY(-50px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 40px 30px;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.6rem;
|
||||
letter-spacing: 2px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 12px 16px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 13px;
|
||||
font-size: 16px;
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
padding: 30px 25px;
|
||||
}
|
||||
|
||||
.modal-content h2 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.container {
|
||||
padding: 30px 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.4rem;
|
||||
letter-spacing: 1.5px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 10px 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 12px;
|
||||
font-size: 15px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
font-size: 12px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.modal-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.modal-content h2 {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.modal-content p {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 360px) {
|
||||
.container {
|
||||
padding: 25px 15px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 10px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
57
Login.html
57
Login.html
@ -1,30 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login Portal</title>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="Login.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="particles"></div>
|
||||
<div id="particles"></div>
|
||||
|
||||
<div class="container">
|
||||
<h1>Login Portal</h1>
|
||||
<div class="container">
|
||||
<h1>Login</h1>
|
||||
|
||||
<form id="loginForm">
|
||||
<div class="input-group">
|
||||
<input type="text" id="username" placeholder="Username" required>
|
||||
</div>
|
||||
<form id="loginForm">
|
||||
<div class="input-group">
|
||||
<input type="text" id="username" placeholder="Username" required>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="password" id="password" placeholder="Password" required>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<input type="password" id="password" placeholder="Password" required>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn">Enter</button>
|
||||
</form>
|
||||
<button type="submit" class="btn">Enter</button>
|
||||
</form>
|
||||
|
||||
<div class="register-link">
|
||||
Don't Have Account? <a href="#" id="registerLink">Register</a>
|
||||
<div class="register-link">
|
||||
Don't Have Account? <a href="Register.html" id="registerLink">Register</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</head>
|
||||
|
||||
<!-- Custom Modal -->
|
||||
<div id="customModal" class="modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-icon" id="modalIcon"></div>
|
||||
<h2 id="modalTitle"></h2>
|
||||
<p id="modalMessage"></p>
|
||||
<button id="modalOkBtn" class="modal-btn">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="Login.js"></script>
|
||||
<script src="Animation Login.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
14
Login.js
14
Login.js
@ -1,14 +0,0 @@
|
||||
// Form handling
|
||||
document.getElementById('loginForm').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const username = document.getElementById('username').value;
|
||||
const password = document.getElementById('password').value;
|
||||
|
||||
alert(Login berhasil!\nUsername: ${username});
|
||||
});
|
||||
|
||||
// Register link handling
|
||||
document.getElementById('registerLink').addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
alert('Halaman Register akan segera dibuat!');
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user