add user creation using shell

This commit is contained in:
meewan 2022-04-03 14:52:55 +02:00
parent 078e06622a
commit 99f3638309

19
app.py
View File

@ -288,5 +288,24 @@ def setup():
print('application setup done')
@application.cli.command("create_user")
def shell_create_user():
name = input("User login: ")
email = input("User email: ")
while True:
password1 = getpass(prompt='Password: ')
password2 = getpass(prompt='Retype your password: ')
if password1 == password2:
break
print("The passwords dont match")
create_user(
name=name,
password=password1,
email=email,
is_admin=False
)
db.session.commit()
if __name__ == "__main__":
application.run(debug=True)