-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeanmal.html
52 lines (47 loc) · 1.77 KB
/
theanmal.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
</head>
<body>
<h1>Login</h1>
<form id="loginForm">
<label>Email:</label>
<input type="email" id="email" required><br><br>
<label>Password:</label>
<input type="password" id="password" required><br><br>
<button type="submit">Login</button>
</form>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.0/firebase-auth.js"></script>
<script>
// Firebase configuration
const firebaseConfig = {
apiKey: "YOUR_FIREBASE_API_KEY",
authDomain: "YOUR_FIREBASE_AUTH_DOMAIN",
projectId: "YOUR_FIREBASE_PROJECT_ID",
storageBucket: "YOUR_FIREBASE_STORAGE_BUCKET",
messagingSenderId: "YOUR_FIREBASE_MESSAGING_SENDER_ID",
appId: "YOUR_FIREBASE_APP_ID"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// Handle Login
document.getElementById('loginForm').addEventListener('submit', function(e) {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
firebase.auth().signInWithEmailAndPassword(email, password)
.then((userCredential) => {
alert('Login successful!');
console.log(userCredential.user);
})
.catch((error) => {
alert('Login failed: ' + error.message);
});
});
</script>
</body>
</html>