diff --git a/server/app.py b/server/app.py index d2462d2..bd9c84d 100644 --- a/server/app.py +++ b/server/app.py @@ -15,7 +15,7 @@ with app.app_context(): db.init_app(app) db.create_all() -app.secret_key = config.SECRET +app.secret_key = config.SECRET_KEY app.config["SQLALCHEMY_DATABASE_URI"] = config.SQLALCHEMY_DATABASE_URI app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = config.SQLALCHEMY_TRACK_MODIFICATIONS diff --git a/server/config.py b/server/config.py index 85f7010..a24d426 100644 --- a/server/config.py +++ b/server/config.py @@ -1,15 +1,16 @@ import os -with open(".secret_key", "a+") as secret: - if not secret.read(): - secret.seek(0) - key = os.urandom(128) - secret.write(key) - secret.flush() - else: - key = secret.read() +secret = open(".secret_key", "a+b") +contents = secret.read() +if not contents: + key = os.urandom(128) + secret.write(key) + secret.flush() +else: + key = contents +secret.close() -SECRET = key +SECRET_KEY = key SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf" SQLALCHEMY_TRACK_MODIFICATIONS = False diff --git a/web/pages/register.html b/web/pages/register.html index 78a7da9..b90c033 100644 --- a/web/pages/register.html +++ b/web/pages/register.html @@ -1,5 +1,7 @@