Fix initial user creation.
sqlite3.connect automatically creates a database file if it doesn't exist yet. Consequently, os.path.isfile will always return true, the auth table won't be created, and inserting a user will fail.
This commit is contained in:
parent
33c0fdcd1f
commit
d23dd0122a
@ -69,8 +69,7 @@ def adduser(username):
|
||||
conn = sqlite3.connect(AUTHDBPATH)
|
||||
cursor = conn.cursor()
|
||||
|
||||
if not os.path.isfile(AUTHDBPATH):
|
||||
cursor.execute( "CREATE TABLE auth "
|
||||
cursor.execute( "CREATE TABLE IF NOT EXISTS auth "
|
||||
"(user VARCHAR PRIMARY KEY, hash VARCHAR)")
|
||||
|
||||
cursor.execute("INSERT INTO auth VALUES (?, ?)", (username, hash))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user