diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2019-02-04 11:34:15 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2019-02-04 11:34:15 +0100 |
commit | 19684c2dbbef8180927286486cd52b5ccf944628 (patch) | |
tree | c6b98b61c5183f20c7bf5ea73ad14a38606b5b4c | |
parent | fix: Entity User has no property 'password', changed to 'pwdhash'. (diff) | |
download | newspipe-19684c2dbbef8180927286486cd52b5ccf944628.tar.gz newspipe-19684c2dbbef8180927286486cd52b5ccf944628.tar.bz2 newspipe-19684c2dbbef8180927286486cd52b5ccf944628.zip |
added a command to add new admin user via command line
-rwxr-xr-x | src/manager.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/manager.py b/src/manager.py index c088ac29..795b3974 100755 --- a/src/manager.py +++ b/src/manager.py @@ -38,6 +38,14 @@ def db_create(): db.create_all() UserController(ignore_context=True).create(**admin) +@manager.command +def create_admin(nickname, password): + "Will create an admin user." + admin = {'is_admin': True, 'is_api': True, 'is_active': True, + 'nickname': nickname, + 'pwdhash': generate_password_hash(password)} + with application.app_context(): + UserController(ignore_context=True).create(**admin) @manager.command def fetch_asyncio(user_id=None, feed_id=None): |