Skip to content

Commit

Permalink
Fixed bug creating default credentials for admin login
Browse files Browse the repository at this point in the history
  • Loading branch information
shashi278 committed Jan 10, 2020
1 parent a17f0df commit 145d8bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,20 @@ def on_start(self):
json.dump(default_setting, jf, indent=4)

db_file = "user_main.db"
conn = self.connect_database(db_file)
try:
self.extractAllData(db_file, "admin", order_by="id")

except Error:
with open("admin_record.sql") as table:
conn = self.connect_database(db_file)
self.create_table(table.read(), conn)
conn = self.connect_database(db_file)
self.insert_into_database(
"admin",
conn,
("", "admin@example.com", "admin", "admin", "", "", ""),
("Admin", "admin@example.com", "admin", "admin", "", "", ""),
)
conn.close()

def build(self):
return Builder.load_file("gui.kv")
Expand Down

0 comments on commit 145d8bd

Please # to comment.