From 19684c2dbbef8180927286486cd52b5ccf944628 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 4 Feb 2019 11:34:15 +0100 Subject: added a command to add new admin user via command line --- src/manager.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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): -- cgit