settings: Don't mention username in fetch API key error message.

There isn't a username prompt in the form for it, so the only
possibility for triggering this error is a wrong password.

Fixes #20924.
This commit is contained in:
jai2201 2022-01-28 08:29:26 +05:30 committed by Tim Abbott
parent 364139feec
commit c14b3a8844
3 changed files with 3 additions and 3 deletions

View File

@ -4345,7 +4345,7 @@ class JSONFetchAPIKeyTest(ZulipTestCase):
user = self.example_user("hamlet")
self.login_user(user)
result = self.client_post("/json/fetch_api_key", dict(password="wrong"))
self.assert_json_error(result, "Your username or password is incorrect.", 400)
self.assert_json_error(result, "Password is incorrect.", 400)
def test_invalid_subdomain(self) -> None:
username = "hamlet"

View File

@ -1143,7 +1143,7 @@ class FetchAPIKeyTest(ZulipTestCase):
def test_fetch_api_key_wrong_password(self) -> None:
self.login("cordelia")
result = self.client_post("/json/fetch_api_key", dict(password="wrong_password"))
self.assert_json_error_contains(result, "password is incorrect")
self.assert_json_error_contains(result, "Password is incorrect")
class InactiveUserTest(ZulipTestCase):

View File

@ -977,7 +977,7 @@ def json_fetch_api_key(
if not authenticate(
request=request, username=user_profile.delivery_email, password=password, realm=realm
):
raise JsonableError(_("Your username or password is incorrect."))
raise JsonableError(_("Password is incorrect."))
api_key = get_api_key(user_profile)
return json_success({"api_key": api_key, "email": user_profile.delivery_email})