Commit 77174aeb authored by Martin Mareš's avatar Martin Mareš
Browse files

Added CLI command "create-user"

parent 4366c587
......@@ -1549,6 +1549,27 @@ def cli_find_course(ident):
cli_die(f'No course with identifier {course_ident} found')
@click.option("--token", help="Login token (default: auto-generate)")
def cli_create_user(first_name, last_name, email, token=None):
"""Create a new account with local login."""
if not token:
token = secrets.token_hex(8)
INSERT INTO owl_users(first_name, last_name, email, auth_token)
VALUES (%s, %s, %s, %s)
(first_name, last_name, email, token))
print(f'Created new user with login token {token}')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment