-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
122 lines (110 loc) · 5.03 KB
/
index.php
File metadata and controls
122 lines (110 loc) · 5.03 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - PIKD</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/c4f218aa74.js" crossorigin="anonymous"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
}
}
}
</script>
</head>
<body class="bg-black min-h-screen flex items-center justify-center p-4">
<div class="max-w-md w-full bg-white rounded-lg shadow-lg p-8">
<div class="text-center mb-8">
<h1 class="text-2xl font-bold text-gray-900">PIKD Artist Portal</h1>
<p class="text-gray-600 mt-2">Please sign in to your account</p>
</div>
<form id="loginForm" class="space-y-6">
<div>
<label for="email" class="block text-sm font-medium text-gray-700">Email address</label>
<input type="email" id="email" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
<input type="password" id="password" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div class="text-red-500 text-sm hidden error">
<i class="fas fa-exclamation-triangle"></i> Please check your email and password.
</div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-black hover:bg-slate-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Sign in
</button>
</form>
<div class="mt-6 space-y-2">
<button id="forgotPassword" class="text-sm text-black hover:text-slate-700 w-full text-center">
Forgot your password?
</button>
<button onclick="location.href='/staff';" class="text-sm text-black hover:text-slate-700 w-full text-center">
Staff Login
</button>
<button onclick="location.href='/others';" class="text-sm text-black hover:text-slate-700 w-full text-center">
External Artists, click here
</button>
</div>
</div>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.13.0/firebase-app.js";
import { getAuth, signInWithEmailAndPassword, sendPasswordResetEmail, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/10.13.0/firebase-auth.js";
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "",
authDomain: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: "nope"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
// Check if user is already logged in
onAuthStateChanged(auth, (user) => {
if (user) {
window.location.href = 'app';
}
});
document.getElementById('loginForm').addEventListener('submit', (e) => {
e.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
window.location.href = 'app';
})
.catch((error) => {
document.querySelector('.error').classList.remove('hidden');
console.error("Error:", error.message);
});
});
document.getElementById('forgotPassword').addEventListener('click', () => {
const email = document.getElementById('email').value;
if (email) {
sendPasswordResetEmail(auth, email)
.then(() => {
alert("Password reset email sent!");
})
.catch((error) => {
alert("Error: " + error.message);
});
} else {
alert("Please enter your email address.");
}
});
</script>
</body>
</html>