aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2020-12-03 17:50:29 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2020-12-03 17:50:29 +0000
commit3657e4c9b05d02c6a9fe7cad7d0e70c7642ec024 (patch)
treed8c21a78978494e4a223fa760698ea9ae3b2dce8
parentadd the flask_app variable to the env (diff)
downloadAnnotateChange-3657e4c9b05d02c6a9fe7cad7d0e70c7642ec024.tar.gz
AnnotateChange-3657e4c9b05d02c6a9fe7cad7d0e70c7642ec024.zip
add option to automatically confirm the admin email
-rw-r--r--app/cli.py11
1 files 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()