Do not username validate get/modify/renew/pwreset/delete in cli
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
c48cce3826
commit
f6cfcf5e29
|
@ -112,11 +112,6 @@ def print_user_lines(d: Dict):
|
||||||
@members.command(short_help='Get info about a user')
|
@members.command(short_help='Get info about a user')
|
||||||
@click.argument('username')
|
@click.argument('username')
|
||||||
def get(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)
|
resp = http_get('/api/members/' + username)
|
||||||
result = handle_sync_response(resp)
|
result = handle_sync_response(resp)
|
||||||
print_user_lines(result)
|
print_user_lines(result)
|
||||||
|
@ -131,11 +126,6 @@ def get(username):
|
||||||
'Set to the empty string to disable forwarding.'
|
'Set to the empty string to disable forwarding.'
|
||||||
))
|
))
|
||||||
def modify(username, login_shell, forwarding_addresses):
|
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:
|
if login_shell is None and forwarding_addresses is None:
|
||||||
click.echo('Nothing to do.')
|
click.echo('Nothing to do.')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -173,11 +163,6 @@ def modify(username, login_shell, forwarding_addresses):
|
||||||
@click.option('--clubrep', is_flag=True, default=False,
|
@click.option('--clubrep', is_flag=True, default=False,
|
||||||
help='Add non-member terms instead of member terms')
|
help='Add non-member terms instead of member terms')
|
||||||
def renew(username, num_terms, clubrep):
|
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)
|
terms = get_terms_for_renewal_for_user(username, num_terms, clubrep)
|
||||||
|
|
||||||
if clubrep:
|
if clubrep:
|
||||||
|
@ -197,11 +182,6 @@ def renew(username, num_terms, clubrep):
|
||||||
@members.command(short_help="Reset a user's password")
|
@members.command(short_help="Reset a user's password")
|
||||||
@click.argument('username')
|
@click.argument('username')
|
||||||
def pwreset(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)
|
click.confirm(f"Are you sure you want to reset {username}'s password?", abort=True)
|
||||||
resp = http_post(f'/api/members/{username}/pwreset')
|
resp = http_post(f'/api/members/{username}/pwreset')
|
||||||
result = handle_sync_response(resp)
|
result = handle_sync_response(resp)
|
||||||
|
@ -211,11 +191,6 @@ def pwreset(username):
|
||||||
@members.command(short_help="Delete a user")
|
@members.command(short_help="Delete a user")
|
||||||
@click.argument('username')
|
@click.argument('username')
|
||||||
def delete(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()
|
check_if_in_development()
|
||||||
click.confirm(f"Are you sure you want to delete {username}?", abort=True)
|
click.confirm(f"Are you sure you want to delete {username}?", abort=True)
|
||||||
resp = http_delete(f'/api/members/{username}')
|
resp = http_delete(f'/api/members/{username}')
|
||||||
|
|
Loading…
Reference in New Issue