spogulis no
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-15 17:37:22 +01:00
Fixed EM101 (raw-string-in-exception): Exception must not use a string literal, assign to variable first
Šī revīzija ir iekļauta:
revīziju iesūtīja
Joshua Tauberer
vecāks
49124cc9ca
revīzija
dd61844ced
@@ -49,10 +49,12 @@ class AuthService:
|
||||
|
||||
username, password = parse_http_authorization_basic(request.headers.get('Authorization', ''))
|
||||
if username in {None, ""}:
|
||||
raise ValueError("Authorization header invalid.")
|
||||
msg = "Authorization header invalid."
|
||||
raise ValueError(msg)
|
||||
|
||||
if username.strip() == "" and password.strip() == "":
|
||||
raise ValueError("No email address, password, session key, or API key provided.")
|
||||
msg = "No email address, password, session key, or API key provided."
|
||||
raise ValueError(msg)
|
||||
|
||||
# If user passed the system API key, grant administrative privs. This key
|
||||
# is not associated with a user.
|
||||
@@ -72,7 +74,8 @@ class AuthService:
|
||||
|
||||
# If no password was given, but a username was given, we're missing some information.
|
||||
elif password.strip() == "":
|
||||
raise ValueError("Enter a password.")
|
||||
msg = "Enter a password."
|
||||
raise ValueError(msg)
|
||||
|
||||
else:
|
||||
# The user is trying to log in with a username and a password
|
||||
@@ -114,7 +117,8 @@ class AuthService:
|
||||
])
|
||||
except:
|
||||
# Login failed.
|
||||
raise ValueError("Incorrect email address or password.")
|
||||
msg = "Incorrect email address or password."
|
||||
raise ValueError(msg)
|
||||
|
||||
# If MFA is enabled, check that MFA passes.
|
||||
status, hints = validate_auth_mfa(email, request, env)
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user