Do not username validate get/modify/renew/pwreset/delete in cli
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Ohm Patel 2024-01-22 05:57:00 +00:00
parent c48cce3826
commit f6cfcf5e29
Signed by: o32patel
GPG Key ID: 096A9E27B27F535C
1 changed files with 0 additions and 25 deletions

View File

@ -112,11 +112,6 @@ def print_user_lines(d: Dict):
@members.command(short_help='Get info about a user')
@click.argument('username')
def get(username):
# Verify that the username is valid before requesting data from API
username_validator = validate_username(username)
if not username_validator.is_valid:
return click.echo("The provided username is invalid")
resp = http_get('/api/members/' + username)
result = handle_sync_response(resp)
print_user_lines(result)
@ -131,11 +126,6 @@ def get(username):
'Set to the empty string to disable forwarding.'
))
def modify(username, login_shell, forwarding_addresses):
# Verify that the username is valid
username_validator = validate_username(username)
if not username_validator.is_valid:
return click.echo("The provided username is invalid")
if login_shell is None and forwarding_addresses is None:
click.echo('Nothing to do.')
sys.exit()
@ -173,11 +163,6 @@ def modify(username, login_shell, forwarding_addresses):
@click.option('--clubrep', is_flag=True, default=False,
help='Add non-member terms instead of member terms')
def renew(username, num_terms, clubrep):
# Verify that the username is valid
username_validator = validate_username(username)
if not username_validator.is_valid:
return click.echo("The provided username is invalid")
terms = get_terms_for_renewal_for_user(username, num_terms, clubrep)
if clubrep:
@ -197,11 +182,6 @@ def renew(username, num_terms, clubrep):
@members.command(short_help="Reset a user's password")
@click.argument('username')
def pwreset(username):
# Verify that the username is valid
username_validator = validate_username(username)
if not username_validator.is_valid:
return click.echo("The provided username is invalid")
click.confirm(f"Are you sure you want to reset {username}'s password?", abort=True)
resp = http_post(f'/api/members/{username}/pwreset')
result = handle_sync_response(resp)
@ -211,11 +191,6 @@ def pwreset(username):
@members.command(short_help="Delete a user")
@click.argument('username')
def delete(username):
# Verify that the username is valid
username_validator = validate_username(username)
if not username_validator.is_valid:
return click.echo("The provided username is invalid")
check_if_in_development()
click.confirm(f"Are you sure you want to delete {username}?", abort=True)
resp = http_delete(f'/api/members/{username}')