Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no-input options for make-admin-user command #469

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AetherUnbound
Copy link
Collaborator

Description of Changes

Fixes #221

This PR adds some CLI options for the make-admin-user command which allows the username, email, and password of the admin account to be specified. This makes it easier to run the command without prompting for any inputs, as is done in the just fresh-start recipe.

Notes for Deployment

None

Screenshots (if appropriate)

N/A

Tests and linting

Run just fresh-start locally and note how the admin creation account step!

  • I have rebased my changes on main

  • just lint passes

  • just test passes

@AetherUnbound AetherUnbound requested a review from a team as a code owner June 26, 2024 05:31
@AetherUnbound AetherUnbound added the docker/env Docker, environment, or CI changes label Jun 26, 2024
Copy link
Collaborator

@sea-kelp sea-kelp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment but otherwise looks great!

Comment on lines +59 to +79
):
"""Add confirmed administrator account."""
while True:
username = input("Username: ")
username = supplied_username or input("Username: ")
user = User.by_username(username).one_or_none()
if user:
print("Username is already in use")
else:
break

while True:
email = input("Email: ")
email = supplied_email or input("Email: ")
user = User.by_email(email).one_or_none()
if user:
print("Email address already in use")
else:
break

while True:
password = getpass("Password: ")
password_again = getpass("Type your password again: ")
password = supplied_password or getpass("Password: ")
password_again = supplied_password or getpass("Type your password again: ")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put the while loops in a if not supplied_... block? I'm a little worried that if an existing email/username is supplied somehow that we'll fall into an infinite loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker/env Docker, environment, or CI changes
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

Add no-input option for make-admin-user
2 participants