aboutsummaryrefslogtreecommitdiff
path: root/src/manager.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2019-02-04 11:34:15 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2019-02-04 11:34:15 +0100
commit19684c2dbbef8180927286486cd52b5ccf944628 (patch)
treec6b98b61c5183f20c7bf5ea73ad14a38606b5b4c /src/manager.py
parentfix: Entity User has no property 'password', changed to 'pwdhash'. (diff)
downloadnewspipe-19684c2dbbef8180927286486cd52b5ccf944628.tar.gz
newspipe-19684c2dbbef8180927286486cd52b5ccf944628.tar.bz2
newspipe-19684c2dbbef8180927286486cd52b5ccf944628.zip
added a command to add new admin user via command line
Diffstat (limited to 'src/manager.py')
-rwxr-xr-xsrc/manager.py8
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):
bgstack15