Vishwanath77 commited on
Commit
7d83462
·
verified ·
1 Parent(s): e188a74

Upload login.html

Browse files
Files changed (1) hide show
  1. src/apps/login.html +297 -0
src/apps/login.html ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Login - Law Bot</title>
8
+ <link rel="stylesheet" href="/static/css/styles.css">
9
+ <style>
10
+ .auth-container {
11
+ max-width: 400px;
12
+ margin: 50px auto;
13
+ padding: 2rem;
14
+ background: rgba(255, 255, 255, 0.1);
15
+ backdrop-filter: blur(10px);
16
+ border-radius: 12px;
17
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
18
+ color: white;
19
+ }
20
+
21
+ .auth-container h2 {
22
+ text-align: center;
23
+ margin-bottom: 1.5rem;
24
+ }
25
+
26
+ .form-group {
27
+ margin-bottom: 1rem;
28
+ }
29
+
30
+ .form-group label {
31
+ display: block;
32
+ margin-bottom: 0.5rem;
33
+ }
34
+
35
+ .form-group input {
36
+ width: 100%;
37
+ padding: 0.75rem;
38
+ border: 1px solid rgba(255, 255, 255, 0.2);
39
+ border-radius: 6px;
40
+ background: rgba(0, 0, 0, 0.2);
41
+ color: white;
42
+ }
43
+
44
+ .btn {
45
+ width: 100%;
46
+ padding: 0.75rem;
47
+ background: #9b87f5;
48
+ color: white;
49
+ border: none;
50
+ border-radius: 6px;
51
+ cursor: pointer;
52
+ font-size: 1rem;
53
+ transition: background 0.3s;
54
+ }
55
+
56
+ .btn:hover {
57
+ background: #7e69d6;
58
+ }
59
+
60
+ .links {
61
+ margin-top: 1rem;
62
+ text-align: center;
63
+ font-size: 0.9rem;
64
+ }
65
+
66
+ .links a {
67
+ color: #D6BCFA;
68
+ text-decoration: none;
69
+ }
70
+
71
+ .links a:hover {
72
+ text-decoration: underline;
73
+ }
74
+
75
+ /* Phase 2: Portal Overlay */
76
+ #portalOverlay {
77
+ position: fixed;
78
+ top: 0;
79
+ left: 0;
80
+ width: 100%;
81
+ height: 100%;
82
+ background: rgba(10, 10, 15, 0.95);
83
+ backdrop-filter: blur(20px);
84
+ z-index: 9999;
85
+ display: none;
86
+ justify-content: center;
87
+ align-items: center;
88
+ flex-direction: column;
89
+ color: white;
90
+ opacity: 0;
91
+ transition: opacity 0.5s ease;
92
+ }
93
+
94
+ #portalOverlay.show {
95
+ display: flex;
96
+ opacity: 1;
97
+ }
98
+
99
+ .portal-pulse {
100
+ width: 80px;
101
+ height: 80px;
102
+ background: #9b87f5;
103
+ border-radius: 50%;
104
+ margin-bottom: 20px;
105
+ animation: portalPulse 2s infinite;
106
+ display: flex;
107
+ justify-content: center;
108
+ align-items: center;
109
+ box-shadow: 0 0 30px rgba(155, 135, 245, 0.5);
110
+ }
111
+
112
+ .portal-pulse svg {
113
+ width: 40px;
114
+ height: 40px;
115
+ color: white;
116
+ }
117
+
118
+ @keyframes portalPulse {
119
+ 0% {
120
+ transform: scale(0.95);
121
+ box-shadow: 0 0 0 0 rgba(155, 135, 245, 0.7);
122
+ }
123
+
124
+ 70% {
125
+ transform: scale(1.1);
126
+ box-shadow: 0 0 0 20px rgba(155, 135, 245, 0);
127
+ }
128
+
129
+ 100% {
130
+ transform: scale(0.95);
131
+ box-shadow: 0 0 0 0 rgba(155, 135, 245, 0);
132
+ }
133
+ }
134
+
135
+ .portal-message {
136
+ font-size: 1.5rem;
137
+ font-weight: 500;
138
+ letter-spacing: 1px;
139
+ text-align: center;
140
+ }
141
+
142
+ .portal-sub {
143
+ font-size: 0.9rem;
144
+ opacity: 0.6;
145
+ margin-top: 10px;
146
+ text-transform: uppercase;
147
+ letter-spacing: 3px;
148
+ }
149
+
150
+ .btn:disabled {
151
+ opacity: 0.7;
152
+ cursor: not-allowed;
153
+ background: #64748b;
154
+ }
155
+
156
+ .professional-footer {
157
+ margin-top: 2rem;
158
+ padding: 1.5rem 0;
159
+ text-align: center;
160
+ border-top: 1px solid rgba(155, 135, 245, 0.1);
161
+ color: rgba(255, 255, 255, 0.5);
162
+ font-size: 0.85rem;
163
+ width: 100%;
164
+ }
165
+
166
+ .professional-footer a {
167
+ color: #9b87f5;
168
+ text-decoration: none;
169
+ font-weight: 500;
170
+ }
171
+
172
+ .professional-footer a:hover {
173
+ text-decoration: underline;
174
+ }
175
+ </style>
176
+ </head>
177
+
178
+ <body class="dark">
179
+ <div id="portalOverlay">
180
+ <div class="portal-pulse">
181
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
182
+ <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
183
+ </svg>
184
+ </div>
185
+ <div class="portal-message" id="portalMessage">INITIALIZING TERMINAL</div>
186
+ <div class="portal-sub">Secure Professional Access</div>
187
+ </div>
188
+
189
+ <div class="auth-container">
190
+ <h2>Login</h2>
191
+ <form id="loginForm">
192
+ <div class="form-group">
193
+ <label for="username">Username</label>
194
+ <input type="text" id="username" required>
195
+ </div>
196
+ <div class="form-group">
197
+ <label for="password">Password</label>
198
+ <input type="password" id="password" required>
199
+ </div>
200
+ <button type="submit" class="btn">Login</button>
201
+ </form>
202
+ <div class="links">
203
+ <a href="/register" id="registerLink">Don't have an account? Register</a><br>
204
+ <a href="/forgot-password">Forgot Password?</a>
205
+ </div>
206
+ <footer class="professional-footer">
207
+ &copy; 2026 Law Bot AI. All Rights Reserved.
208
+ <br>
209
+ Developed & Managed by <a href="https://www.linkedin.com/in/vishwanath77" target="_blank">Vishwanath</a>
210
+ </footer>
211
+ </div>
212
+
213
+ <script>
214
+ const urlParams = new URLSearchParams(window.location.search);
215
+ const role = urlParams.get('role');
216
+
217
+ if (role) {
218
+ document.getElementById('registerLink').href = `/register?role=${role}`;
219
+ }
220
+
221
+ document.getElementById('loginForm').addEventListener('submit', async (e) => {
222
+ e.preventDefault();
223
+ const username = document.getElementById('username').value;
224
+ const password = document.getElementById('password').value;
225
+
226
+ try {
227
+ const response = await fetch('/api/login', {
228
+ method: 'POST',
229
+ headers: { 'Content-Type': 'application/json' },
230
+ body: JSON.stringify({ username, password, role })
231
+ });
232
+
233
+ const loginBtn = document.querySelector('.btn');
234
+ const originalBtnText = loginBtn.innerText;
235
+ loginBtn.disabled = true;
236
+ loginBtn.innerText = 'Verifying...';
237
+
238
+ const data = await response.json();
239
+ if (response.ok) {
240
+ localStorage.setItem('token', data.access_token);
241
+
242
+ const rolePages = {
243
+ 'Admin': '/users',
244
+ 'Judge': 'judgedashboard.html',
245
+ 'Advocate/Lawyer': 'advocatedashboard.html',
246
+ 'Woman': 'woman.html',
247
+ 'Citizen': 'citizen.html',
248
+ 'Student': 'studentdashboard.html',
249
+ 'Minor': 'minor.html'
250
+ };
251
+
252
+ const roleMessages = {
253
+ 'Admin': 'Authenticating Admin Privileges. Accessing Management Center...',
254
+ 'Judge': 'Initializing Judicial Terminal...',
255
+ 'Advocate/Lawyer': 'Welcome back, Counselor. Securing portal...',
256
+ 'Woman': 'Welcome to Shakti Empowerment Hub...',
257
+ 'Citizen': 'Accessing Law Bot Public Terminal...',
258
+ 'Student': 'Setting up your legal study environment...',
259
+ 'Minor': 'Hello! Getting Law Bot ready for you...'
260
+ };
261
+
262
+ let userRole = data.role;
263
+ if (data.role === 'Admin' && role) {
264
+ userRole = role;
265
+ } else if (!userRole && role) {
266
+ userRole = role;
267
+ }
268
+
269
+ // Show professional portal overlay
270
+ const overlay = document.getElementById('portalOverlay');
271
+ const msgEl = document.getElementById('portalMessage');
272
+ msgEl.innerText = roleMessages[userRole] || 'Access Granted. Entering Portal...';
273
+ overlay.classList.add('show');
274
+
275
+ // Brief delay for the aesthetic "Secure Entry" feel before redirect
276
+ setTimeout(() => {
277
+ if (userRole && rolePages[userRole]) {
278
+ window.location.href = rolePages[userRole];
279
+ } else {
280
+ window.location.href = '/';
281
+ }
282
+ }, 1200);
283
+
284
+ } else {
285
+ loginBtn.disabled = false;
286
+ loginBtn.innerText = originalBtnText;
287
+ alert(data.detail || 'Login failed');
288
+ }
289
+ } catch (error) {
290
+ console.error('Error:', error);
291
+ alert('An error occurred');
292
+ }
293
+ });
294
+ </script>
295
+ </body>
296
+
297
+ </html>