-
Notifications
You must be signed in to change notification settings - Fork 109
Description
Some kci user
commands such as kci user password reset
and kci user verify
currently take a username argument to find the user in order to be consistent with other commands. However, these operations rely on an email address and could also be done just by providing an email address instead of the username. Generally speaking, as usernames can't contain symbols such as @
(to be confirmed...) then users can be found using either their username or email in exactly the same way.
So all the kci user
command that have a username
argument could instead have a login
argument which could be either a username or an email address. Then we could have a helper method in kernelci.cli
to get a user from the API:
def find_user(api, login):
users = (
api.user.find({"username": login}) or
api.user.find({"email": login})
)
if not users:
raise click.ClickException(f"User not found: {login}")
return users[0]
This might even be made part of the APIHelper class, without the Click exception.