chatmobile-expresso / login.html
Tittoap's picture
coloque botao sair, e verifiiqu o backende impletme todas as funciaonlaidades deisponiveis
547bc55 verified
Raw
History Blame Contribute Delete
4.3 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - FireChat Flames</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script>
<style>
.login-container {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
</style>
</head>
<body class="min-h-screen flex items-center justify-center login-container">
<div class="bg-gray-900 bg-opacity-80 rounded-xl p-8 max-w-md w-full shadow-2xl border border-purple-900">
<div class="text-center mb-8">
<h1 class="text-3xl font-bold bg-gradient-to-r from-purple-400 via-pink-500 to-red-500 bg-clip-text text-transparent mb-2">FireChat Flames</h1>
<p class="text-gray-400">Connect with friends instantly</p>
</div>
<form id="login-form" class="space-y-6">
<div>
<label for="email" class="block text-sm font-medium text-gray-300 mb-1">Email</label>
<input type="email" id="email" required
class="w-full px-4 py-3 bg-gray-800 border border-purple-900 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-white">
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-300 mb-1">Password</label>
<input type="password" id="password" required
class="w-full px-4 py-3 bg-gray-800 border border-purple-900 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-white">
</div>
<button type="submit" class="w-full py-3 px-4 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 rounded-lg font-medium text-white transition duration-200">
Login
</button>
</form>
<div class="mt-6 text-center">
<p class="text-gray-400">Don't have an account? <a href="/signup.html" class="text-purple-400 hover:text-purple-300">Sign up</a></p>
</div>
<div id="error-message" class="mt-4 text-red-400 text-sm text-center hidden"></div>
</div>
<script>
// Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyA4MtyRVloOv6WWR_KyF4bM0UqD91gwykY",
authDomain: "app-teste-x.firebaseapp.com",
projectId: "app-teste-x"
};
firebase.initializeApp(firebaseConfig);
const auth = firebase.auth();
// Verify backend connection on load
async function verifyBackend() {
try {
const response = await fetch('https://us-central1-app-teste-x.cloudfunctions.net/api/health', {
method: 'GET'
});
if (!response.ok) {
errorMessage.textContent = 'Backend service unavailable. Please try again later.';
errorMessage.classList.remove('hidden');
}
} catch (error) {
errorMessage.textContent = 'Unable to connect to backend service';
errorMessage.classList.remove('hidden');
}
}
verifyBackend();
// DOM elements
const loginForm = document.getElementById('login-form');
const errorMessage = document.getElementById('error-message');
// Event listeners
loginForm.addEventListener('submit', async (e) => {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
try {
const userCredential = await auth.signInWithEmailAndPassword(email, password);
window.location.href = '/';
} catch (error) {
errorMessage.textContent = error.message;
errorMessage.classList.remove('hidden');
setTimeout(() => errorMessage.classList.add('hidden'), 5000);
}
});
</script>
</body>
</html>