Skip to content

Commit

Permalink
[lib] Show user-friendly error when claimUsername fails due to incorr…
Browse files Browse the repository at this point in the history
…ect password

Summary: This addresses [ENG-9474](https://linear.app/comm/issue/ENG-9474/user-grey-is-unable-to-sign-in).

Test Plan: {F2867885}

Reviewers: varun, will

Reviewed By: will

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13578
  • Loading branch information
Ashoat committed Oct 3, 2024
1 parent 5d5760b commit e4af63a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions lib/actions/user-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,23 @@ function useIdentityPasswordLogIn(): (
) {
throw e;
}
const { message, signature } = await callClaimUsername({
username,
password,
});
let message, signature;
try {
const callClaimUsernameResult = await callClaimUsername({
username,
password,
});
({ message, signature } = callClaimUsernameResult);
} catch (claimException) {
if (
getMessageForException(claimException) === 'invalid_credentials'
) {
// This error means the password was incorrect
throw new Error('login_failed');
} else {
throw claimException;
}
}
result = await registerReservedPasswordUser(
username,
password,
Expand Down

0 comments on commit e4af63a

Please sign in to comment.