Skip to content

Commit

Permalink
feat: updated error codes/messages and related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Sep 4, 2023
1 parent 291524d commit e940dfe
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 51 deletions.
2 changes: 1 addition & 1 deletion lib/build/emailpassword-shared6.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/build/passwordless-shared3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/build/recipe/thirdparty/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/build/recipe/thirdpartyemailpassword/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/build/recipe/thirdpartypasswordless/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions lib/build/thirdparty-shared2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const defaultTranslationsEmailPassword = {
"Password must contain at least one alphabet": undefined,
"Password must contain at least one number": undefined,
"Email is invalid": undefined,
"Token generation was not done because of account take over risk. Please contact support. (HAS_OTHER_EMAIL_OR_PHONE)":
"Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)":
undefined,
},
};
6 changes: 4 additions & 2 deletions lib/ts/recipe/passwordless/components/themes/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export const defaultTranslationsPasswordless = {
"Failed to generate a one time code. Please try again": undefined,
"Phone number is invalid": undefined,
"Email is invalid": undefined,
"Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_UP_ALLOWED_FALSE)": undefined,
"Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)": undefined,
"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_002)":
undefined,
"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_003)":
undefined,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const SignInAndUpCallback: React.FC<PropType> = (props) => {
history: props.history,
queryParams: {
error: response.status,
message: "reason" in response ? response.reason : response.status,
message: response.reason,
},
redirectBack: false,
});
Expand Down
11 changes: 7 additions & 4 deletions lib/ts/recipe/thirdparty/components/themes/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ export const defaultTranslationsThirdParty = {
THIRD_PARTY_PROVIDER_DEFAULT_BTN_END: "",

THIRD_PARTY_ERROR_NO_EMAIL: "Could not retrieve email. Please try a different method.",
EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT:
"Cannot sign in / up due to security reasons. Please contact support. (EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT)",

/*
* The following are error messages from our backend SDK.
* These are returned as full messages to preserver compatibilty, but they work just like the keys above.
* They are shown as is by default (setting the value to undefined will display the raw translation key)
*/
"Cannot sign in / up due to security reasons. Please contact support. (IS_SIGN_IN_ALLOWED_FALSE)": undefined,
"Cannot sign in / up because new email cannot be applied to existing account. Please contact support. (ANOTHER_PRIM_USER_HAS_EMAIL)":

"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_004)":
undefined,
"Cannot sign in / up because new email cannot be applied to existing account. Please contact support. (ERR_CODE_005)":
undefined,

"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_006)":
undefined,
},
};
4 changes: 2 additions & 2 deletions lib/ts/recipe/thirdparty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ export default class Wrapper {
fetchResponse: Response;
}
| {
status: "NO_EMAIL_GIVEN_BY_PROVIDER" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
status: "NO_EMAIL_GIVEN_BY_PROVIDER";
fetchResponse: Response;
}
| {
status: "SIGN_IN_UP_NOT_ALLOWED";
status: "SIGN_IN_UP_NOT_ALLOWED" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
reason: string;
fetchResponse: Response;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ts/recipe/thirdpartyemailpassword/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ export default class Wrapper {
fetchResponse: Response;
}
| {
status: "NO_EMAIL_GIVEN_BY_PROVIDER" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
status: "NO_EMAIL_GIVEN_BY_PROVIDER";
fetchResponse: Response;
}
| {
status: "SIGN_IN_UP_NOT_ALLOWED";
status: "SIGN_IN_UP_NOT_ALLOWED" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
reason: string;
fetchResponse: Response;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ts/recipe/thirdpartypasswordless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export default class Wrapper {
fetchResponse: Response;
}
| {
status: "NO_EMAIL_GIVEN_BY_PROVIDER" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
status: "NO_EMAIL_GIVEN_BY_PROVIDER";
fetchResponse: Response;
}
| {
status: "SIGN_IN_UP_NOT_ALLOWED";
status: "SIGN_IN_UP_NOT_ALLOWED" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
reason: string;
fetchResponse: Response;
}
Expand Down
Loading

0 comments on commit e940dfe

Please sign in to comment.