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