Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/backend/src/couchers/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"invalid_message": "Invalid message.",
"invalid_name": "Name not supported.",
"invalid_notification_preference": "Invalid notification preference.",
"invalid_password": "Wrong password.",
"invalid_password": "Wrong username/email or password.",
"invalid_phone": "Phone number must be in international format without punctuation.",
"invalid_recipients": "Invalid recipients list.",
"invalid_region": "Invalid region.",
Expand Down
4 changes: 2 additions & 2 deletions app/backend/src/couchers/servicers/account.py
Comment thread
kevinortiz43 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def ChangePasswordV2(
user = session.execute(select(User).where(User.id == context.user_id)).scalar_one()

if not verify_password(user.hashed_password, request.old_password):
# wrong password
# Wrong username/email or password
context.abort_with_error_code(grpc.StatusCode.INVALID_ARGUMENT, "invalid_password")

abort_on_invalid_password(request.new_password, context)
Expand Down Expand Up @@ -238,7 +238,7 @@ def ChangeEmailV2(

# check password first
if not verify_password(user.hashed_password, request.password):
# wrong password
# Wrong username/email or password
context.abort_with_error_code(grpc.StatusCode.INVALID_ARGUMENT, "invalid_password")

# not a valid email
Expand Down
4 changes: 2 additions & 2 deletions app/backend/src/couchers/servicers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ def Authenticate(self, request: auth_pb2.AuthReq, context: CouchersContext, sess
)
return _auth_res(user)
else:
logger.debug("Wrong password")
# wrong password
logger.debug("Wrong username/email or password")
# Wrong username/email or password
context.abort_with_error_code(grpc.StatusCode.NOT_FOUND, "invalid_password")
else: # user not found
# check if this is an email and they tried to sign up but didn't complete
Expand Down
12 changes: 6 additions & 6 deletions app/backend/src/tests/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ def test_ChangePasswordV2_normal_wrong_password(db, fast_passwords):
with pytest.raises(grpc.RpcError) as e:
account.ChangePasswordV2(
account_pb2.ChangePasswordV2Req(
old_password="wrong password",
old_password="Wrong username/email or password",
Comment thread
kevinortiz43 marked this conversation as resolved.
Outdated
new_password=new_password,
)
)
assert e.value.code() == grpc.StatusCode.INVALID_ARGUMENT
assert e.value.details() == "Wrong password."
assert e.value.details() == "Wrong username/email or password."

with session_scope() as session:
updated_user = session.execute(select(User).where(User.id == user.id)).scalar_one()
Expand Down Expand Up @@ -319,12 +319,12 @@ def test_ChangeEmailV2_wrong_password(db, fast_passwords):
with pytest.raises(grpc.RpcError) as e:
account.ChangeEmailV2(
account_pb2.ChangeEmailV2Req(
password="wrong password",
password="Wrong username/email or password",
new_email=new_email,
)
)
assert e.value.code() == grpc.StatusCode.INVALID_ARGUMENT
assert e.value.details() == "Wrong password."
assert e.value.details() == "Wrong username/email or password."

with session_scope() as session:
assert (
Expand All @@ -346,12 +346,12 @@ def test_ChangeEmailV2_wrong_email(db, fast_passwords):
with pytest.raises(grpc.RpcError) as e:
account.ChangeEmailV2(
account_pb2.ChangeEmailV2Req(
password="wrong password",
password="Wrong username/email or password",
new_email=new_email,
)
)
assert e.value.code() == grpc.StatusCode.INVALID_ARGUMENT
assert e.value.details() == "Wrong password."
assert e.value.details() == "Wrong username/email or password."

with session_scope() as session:
assert (
Expand Down
2 changes: 1 addition & 1 deletion app/backend/src/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def test_unsuccessful_authenticate(db):
with pytest.raises(grpc.RpcError) as e:
reply = auth_api.Authenticate(auth_pb2.AuthReq(user=user.username, password="incorrectpassword"))
assert e.value.code() == grpc.StatusCode.NOT_FOUND
assert e.value.details() == "Wrong password."
assert e.value.details() == "Wrong username/email or password."

# Invalid username
with auth_api_session() as (auth_api, metadata_interceptor):
Expand Down
Loading