after biome unsafe, restart frontend, add superadmin
This commit is contained in:
parent
25fcd99acf
commit
c02b519eee
41 changed files with 189 additions and 910 deletions
|
@ -1,198 +0,0 @@
|
|||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.content {
|
||||
border: 1px solid var(--border);
|
||||
background-color: var(--background-secondary);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2rem;
|
||||
width: clamp(200px, 50%, 300px);
|
||||
}
|
||||
|
||||
.content form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.auth-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(31 30 30 / 90%) 0%,
|
||||
rgba(45 45 45 / 90%) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.auth-logo {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.auth-logo h1 {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.auth-logo p {
|
||||
color: var(--text-secondary);
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
background-color: var(--background-secondary);
|
||||
border-radius: 8px;
|
||||
box-shadow: var(--card-shadow);
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
overflow: hidden;
|
||||
animation: fade-in 0.5s ease;
|
||||
}
|
||||
|
||||
.auth-header {
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background-color: rgba(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
.auth-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.auth-form {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.auth-form form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.auth-toggle {
|
||||
text-align: center;
|
||||
margin-top: 1.5rem;
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.form-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 0.9rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.form-footer a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.form-footer a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.form-footer label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.auth-form button {
|
||||
margin-top: 0.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.password-group {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.password-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.password-wrapper input {
|
||||
width: 100%;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
.toggle-password {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
cursor: pointer;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
fill: var(--text-secondary);
|
||||
transition: fill 0.2s ease;
|
||||
}
|
||||
|
||||
.toggle-password:hover {
|
||||
fill: var(--text);
|
||||
}
|
||||
|
||||
.error-message {
|
||||
color: var(--error);
|
||||
background-color: rgb(237 66 69 / 10%);
|
||||
padding: 0.75rem;
|
||||
margin-bottom: 1.5rem;
|
||||
border-radius: 4px;
|
||||
display: none;
|
||||
font-size: 0.9rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-20px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.auth-link {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.auth-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@media (width <= 480px) {
|
||||
.auth-card {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.auth-logo h1 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
body {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
/* sidebar */
|
||||
|
||||
.sidebar {
|
||||
background-color: var(--background-secondary);
|
||||
width: 220px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-right: 1px solid var(--border);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sidebar .actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sidebar .actions .action {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
gap: .5rem;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
height: 3rem;
|
||||
width: 100%;
|
||||
transition: background-color 0.2s ease;
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.sidebar .actions .action svg {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.sidebar .actions .action:hover {
|
||||
background-color: var(--background);
|
||||
}
|
||||
|
||||
.sidebar .actions .action.active {
|
||||
background-color: var(--background);
|
||||
}
|
||||
|
||||
.sidebar .actions .action.active:hover {
|
||||
background-color: var(--background-secondary);
|
||||
}
|
||||
|
||||
.sidebar .user-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
border-top: 1px solid var(--border);
|
||||
background-color: rgba(0 0 0 / 10%);
|
||||
}
|
||||
|
||||
.sidebar .user-area img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.sidebar .user-area .username {
|
||||
margin-top: 1rem;
|
||||
font-weight: bold;
|
||||
color: var(--text);
|
||||
}
|
|
@ -46,82 +46,3 @@ body {
|
|||
background-color: var(--background);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
textarea,
|
||||
select {
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
button,
|
||||
.button {
|
||||
cursor: pointer;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border: none;
|
||||
background-color: var(--accent);
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
.button:hover {
|
||||
background-color: var(--accent-hover);
|
||||
}
|
||||
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--border);
|
||||
background-color: var(--input-background);
|
||||
color: var(--text);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 2px rgb(88 101 242 / 30%);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: bold;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
svg {
|
||||
fill: var(--svg-fill);
|
||||
transition: fill 0.2s ease;
|
||||
}
|
||||
|
||||
svg.stroke-only {
|
||||
fill: none;
|
||||
stroke: var(--svg-fill);
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
svg:hover {
|
||||
fill: var(--accent);
|
||||
}
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
const loginForm = document.getElementById("login-form");
|
||||
const registerForm = document.getElementById("register-form");
|
||||
const errorMessage = document.getElementById("error-message");
|
||||
const rememberMe = document.getElementById("remember-me");
|
||||
const emailInput = document.getElementById("email");
|
||||
|
||||
if (emailInput && localStorage.getItem("email")) {
|
||||
emailInput.value = localStorage.getItem("email");
|
||||
}
|
||||
|
||||
if (loginForm) {
|
||||
loginForm.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const email = emailInput?.value.trim();
|
||||
const password = document.getElementById("password")?.value.trim();
|
||||
|
||||
if (!email || !password) {
|
||||
if (errorMessage) {
|
||||
errorMessage.style.display = "block";
|
||||
errorMessage.textContent = "Please enter both email and password.";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (rememberMe?.checked) {
|
||||
localStorage.setItem("email", email);
|
||||
} else {
|
||||
sessionStorage.setItem("email", email);
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "same-origin",
|
||||
body: JSON.stringify({ email, password }),
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
window.location.href = "/dashboard";
|
||||
} else {
|
||||
if (errorMessage) {
|
||||
errorMessage.style.display = "block";
|
||||
errorMessage.textContent =
|
||||
data.error || "Invalid email or password. Please try again.";
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Login error:", error);
|
||||
if (errorMessage) {
|
||||
errorMessage.style.display = "block";
|
||||
errorMessage.textContent = "An error occurred. Please try again.";
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (registerForm) {
|
||||
registerForm.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const email = emailInput?.value.trim();
|
||||
const username = document.getElementById("username")?.value.trim();
|
||||
const password = document.getElementById("password")?.value.trim();
|
||||
const inviteCode = document.getElementById("invite-code")?.value.trim();
|
||||
|
||||
if (!email || !password) {
|
||||
if (errorMessage) {
|
||||
errorMessage.style.display = "block";
|
||||
errorMessage.textContent = "Please enter email, password.";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/auth/register", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "same-origin",
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
invite: inviteCode,
|
||||
}),
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
window.location.href = "/dashboard";
|
||||
} else {
|
||||
if (errorMessage) {
|
||||
errorMessage.style.display = "block";
|
||||
|
||||
if (Array.isArray(data.errors)) {
|
||||
errorMessage.innerHTML = data.errors
|
||||
.map((err) => `<p>${err}</p>`)
|
||||
.join("");
|
||||
} else {
|
||||
errorMessage.textContent =
|
||||
data.error || "An error occurred. Please try again.";
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Register error:", error);
|
||||
if (errorMessage) {
|
||||
errorMessage.style.display = "block";
|
||||
errorMessage.textContent = "An error occurred. Please try again.";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const passwordInput = document.getElementById("password");
|
||||
const togglePassword = document.getElementById("toggle-password");
|
||||
|
||||
togglePassword.addEventListener("click", () => {
|
||||
if (passwordInput.type === "password") {
|
||||
passwordInput.type = "text";
|
||||
togglePassword.innerHTML =
|
||||
'<path d="M12 4.5c-5 0-9.27 3.11-11 7.5 1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"/>';
|
||||
} else {
|
||||
passwordInput.type = "password";
|
||||
togglePassword.innerHTML =
|
||||
'<path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5zm0-9a3.5 3.5 0 100 7 3.5 3.5 0 000-7z"/>';
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue