1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-26 02:57:04 +00:00

if you make an API call with a user-specific API key (e.g. from control panel) but your account no longer exists on the system, there was an unhandled error

see 1039a08be6
This commit is contained in:
Joshua Tauberer 2015-04-28 07:05:49 -04:00
parent 5efd5abbe4
commit f98afac6df

View File

@ -111,12 +111,12 @@ class KeyAuthService:
# Login failed. # Login failed.
raise ValueError("Invalid password.") raise ValueError("Invalid password.")
# Get privileges for authorization. # Get privileges for authorization. This call should never fail on a valid user,
# but if the caller passed a user-specific API key then the user may no longer
# (This call should never fail on a valid user. But if it did fail, it would # exist --- in that case, get_mail_user_privileges will return a tuple of an
# return a tuple of an error message and an HTTP status code.) # error message and an HTTP status code.
privs = get_mail_user_privileges(email, env) privs = get_mail_user_privileges(email, env)
if isinstance(privs, tuple): raise Exception("Error getting privileges.") if isinstance(privs, tuple): raise ValueError(privs[0])
# Return a list of privileges. # Return a list of privileges.
return privs return privs