Spaces:
Sleeping
Sleeping
Upload server.py
Browse files
server.py
CHANGED
|
@@ -33,12 +33,16 @@ def init_db():
|
|
| 33 |
is_active boolean, face_data text, last_login datetime,
|
| 34 |
password text
|
| 35 |
)''')
|
| 36 |
-
# FORCE INIT: Ensure the
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
else:
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
conn.commit()
|
| 44 |
c.execute('''CREATE TABLE IF NOT EXISTS sessions (
|
|
|
|
| 33 |
is_active boolean, face_data text, last_login datetime,
|
| 34 |
password text
|
| 35 |
)''')
|
| 36 |
+
# FORCE INIT: Ensure the student exists and has the correct password on every start
|
| 37 |
+
email = 'ugs23020_csm.gowthami@cbit.org.in'
|
| 38 |
+
c.execute("SELECT id FROM users WHERE LOWER(email) = ?", (email,))
|
| 39 |
+
if not c.fetchone():
|
| 40 |
+
c.execute("INSERT INTO users (id, email, name, role, roll_number, is_active, password) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
| 41 |
+
(str(uuid.uuid4()), email, 'Gowthami', 'student', 'UGS23020', True, 'CBIT2024'))
|
| 42 |
+
print(f"DEBUG: Created new student account for {email}")
|
| 43 |
else:
|
| 44 |
+
c.execute("UPDATE users SET password = 'CBIT2024' WHERE LOWER(email) = ?", (email,))
|
| 45 |
+
print(f"DEBUG: Updated password for existing account {email}")
|
| 46 |
|
| 47 |
conn.commit()
|
| 48 |
c.execute('''CREATE TABLE IF NOT EXISTS sessions (
|