-
Notifications
You must be signed in to change notification settings - Fork 1
/
init_create_admin.py
29 lines (23 loc) · 997 Bytes
/
init_create_admin.py
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
from werkzeug.security import generate_password_hash
import sqlite3
# Assuming you're using the schema provided
DATABASE = 'verification_results.db'
def create_admin_user(username, password):
# Connect to the database
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
# Hash the password for secure storage
hashed_password = generate_password_hash(password)
# Insert the new admin user
cur.execute("INSERT INTO user (username, password, is_admin) VALUES (?, ?, ?)",
(username, hashed_password, True))
# Commit the changes and close the connection
conn.commit()
conn.close()
print(f"Admin user '{username}' created successfully.")
if __name__ == "__main__":
# admin_username = input("Enter admin username: ")
# admin_password = input("Enter admin password: ")/Users/kk/Documents/code/checkAppleID/Dockerfile
admin_username = "admin"
admin_password = "passwd"
create_admin_user(admin_username, admin_password)