Check if user already exist
This commit is contained in:
parent
1fe1e0e9cf
commit
2ba8a9bd13
@ -39,6 +39,7 @@ def create_app():
|
||||
db.create_all()
|
||||
|
||||
if os.getenv("BOT_USER") is not None and os.getenv("BOT_PASSWORD") is not None:
|
||||
if db.session.query(User).filter_by(username=os.getenv("BOT_USER")).first() is None: # Check if user already exist
|
||||
bot = User(
|
||||
username=os.getenv("BOT_USER"),
|
||||
password=hash_password(os.getenv("BOT_PASSWORD")),
|
||||
@ -48,6 +49,7 @@ def create_app():
|
||||
db.session.commit()
|
||||
|
||||
if os.getenv("ADMIN_USER") is not None and os.getenv("ADMIN_PASSWORD") is not None:
|
||||
if db.session.query(User).filter_by(username=os.getenv("ADMIN_USER")).first() is None: # Check if user already exist
|
||||
admin = User(
|
||||
username=os.getenv("ADMIN_USER"),
|
||||
password=hash_password(os.getenv("ADMIN_PASSWORD")),
|
||||
|
Loading…
Reference in New Issue
Block a user