From 3657e4c9b05d02c6a9fe7cad7d0e70c7642ec024 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Thu, 3 Dec 2020 17:50:29 +0000 Subject: add option to automatically confirm the admin email --- app/cli.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/cli.py b/app/cli.py index 64ed0b1..54543d8 100644 --- a/app/cli.py +++ b/app/cli.py @@ -4,6 +4,7 @@ # License: See LICENSE file # Copyright: 2020 (c) The Alan Turing Institute +import click import getpass from email_validator import validate_email @@ -18,7 +19,8 @@ def register(app): pass @admin.command() - def add(): + @click.option("--auto-confirm-email", is_flag=True) + def add(auto_confirm_email): username = input("Enter username: ") email = input("Enter email address: ") password = getpass.getpass() @@ -30,7 +32,12 @@ def register(app): validate_email(email) - user = User(username=username, email=email, is_admin=True) + user = User( + username=username, + email=email, + is_admin=True, + is_confirmed=auto_confirm_email, + ) user.set_password(password) db.session.add(user) db.session.commit() -- cgit v1.2.3