Files
rx.scoreodonto.com/dental-server/auth_legacy/login.html
T
VPS 4 Deploy Agent d6ae290e56
continuous-integration/webhook Falha no deploy (VPS4)
feat: migrate vanilla js to react vite spa
2026-05-30 18:26:56 +02:00

260 lines
7.8 KiB
HTML

<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - Dental Server</title>
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
<style>
:root {
--primary-color: #4f46e5;
--secondary-color: #ec4899;
--dark-color: #0f172a;
--bg-color: #f8fafc;
--bg-surface: #ffffff;
--border-color: #e2e8f0;
--text-primary: #1e293b;
--text-secondary: #64748b;
--radius-lg: 20px;
--shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: linear-gradient(135deg, var(--bg-color) 0%, #eff6ff 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.login-container {
background: var(--bg-surface);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
padding: 48px;
max-width: 420px;
width: 100%;
border: 1px solid var(--border-color);
}
h1 {
text-align: center;
font-size: 2.2rem;
margin-bottom: 8px;
font-weight: 700;
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
p {
text-align: center;
color: var(--text-secondary);
margin-bottom: 32px;
font-size: 1.05rem;
font-weight: 500;
}
.form-group {
margin-bottom: 24px;
}
label {
display: block;
margin-bottom: 8px;
color: var(--text-primary);
font-weight: 600;
font-size: 0.95rem;
}
input {
width: 100%;
padding: 14px 16px;
border: 2px solid var(--border-color);
border-radius: 12px;
font-size: 1rem;
transition: all 0.2s ease;
color: var(--text-primary);
background: var(--bg-color);
outline: none;
}
input:focus {
border-color: var(--primary-color);
background: var(--bg-surface);
box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}
button {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, var(--primary-color) 0%, #4338ca 100%);
color: white;
border: none;
border-radius: 12px;
font-size: 1.05rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
margin-top: 8px;
box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}
button:active {
transform: translateY(0);
}
.alert {
padding: 14px 16px;
border-radius: 12px;
margin-bottom: 24px;
display: none;
font-weight: 500;
font-size: 0.95rem;
}
.alert.error {
background: rgba(239, 68, 68, 0.1);
color: #dc2626;
border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert.success {
background: rgba(16, 185, 129, 0.1);
color: #059669;
border: 1px solid rgba(16, 185, 129, 0.2);
}
#loginBtn {
position: relative;
}
#loginBtn.loading {
opacity: 0.8;
cursor: not-allowed;
color: transparent;
}
#loginBtn.loading::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 20px;
height: 20px;
border: 3px solid rgba(255,255,255,0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: translate(-50%, -50%) rotate(360deg); }
}
</style>
</head>
<body>
<div class="login-container">
<h1>🦷 Dental Server</h1>
<p>Área Administrativa</p>
<div class="alert error" id="errorAlert"></div>
<form id="loginForm">
<div class="form-group">
<label for="username">Usuário ou Email</label>
<input
type="text"
id="username"
name="username"
required
autofocus
placeholder="rcesar ou rcesar@rcesar.com"
>
</div>
<div class="form-group">
<label for="password">Senha</label>
<input
type="password"
id="password"
name="password"
required
placeholder="Digite sua senha"
>
</div>
<button type="submit" class="btn" id="loginBtn">Entrar</button>
<div style="text-align: center; margin-top: 20px; color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;">
v2.1.0
</div>
</form>
</div>
<script>
const loginForm = document.getElementById('loginForm');
const errorAlert = document.getElementById('errorAlert');
const loginBtn = document.getElementById('loginBtn');
loginForm.addEventListener('submit', async (e) => {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
// Mostrar loading
loginBtn.classList.add('loading');
loginBtn.disabled = true;
errorAlert.style.display = 'none';
try {
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ username, password })
});
const data = await response.json();
if (data.success && data.token) {
// Salvar token
localStorage.setItem('auth_token', data.token);
// Redirecionar usando replace para evitar loop no histórico
window.location.replace('/');
} else {
throw new Error(data.error || 'Erro ao fazer login');
}
} catch (error) {
errorAlert.textContent = error.message;
errorAlert.style.display = 'block';
} finally {
loginBtn.classList.remove('loading');
loginBtn.disabled = false;
}
});
// Verificar se já está logado (desabilitado para evitar loops - usuário pode fazer login manualmente)
// A verificação de autenticação será feita na página principal (app.js)
</script>
</body>
</html>