Skip to content

Commit

Permalink
feat: remove EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT + update version n…
Browse files Browse the repository at this point in the history
…umber
  • Loading branch information
porcellus committed Sep 7, 2023
1 parent ee794ff commit c58b6e3
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 53 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- User type has changed across recipes and functions: recipe specific user types have been removed and replaced by a generic one that contains more information
- `createdNewUser` has been renamed to `createdNewRecipeUser`
- `createCode`, `consumeCode`, `createPasswordlessCode` and `consumePasswordlessCode` can now return status: `SIGN_IN_UP_NOT_ALLOWED`
- `signInAndUp` and `thirdPartySignInAndUp` can now return new statuses: `EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT`, `SIGN_IN_UP_NOT_ALLOWED`
- `signInAndUp` and `thirdPartySignInAndUp` can now return new status: `SIGN_IN_UP_NOT_ALLOWED`
- `sendPasswordResetEmail` can now return `status: "PASSWORD_RESET_NOT_ALLOWED"`

## [0.34.1] - 2023-07-31
Expand Down
2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion lib/build/recipe/thirdpartypasswordless/index.d.ts

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

5 changes: 1 addition & 4 deletions lib/build/thirdparty-shared2.js

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

2 changes: 1 addition & 1 deletion lib/build/version.d.ts

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 @@ -54,10 +54,7 @@ const SignInAndUpCallback: React.FC<PropType> = (props) => {
});
}

if (
response.status === "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT" ||
response.status === "SIGN_IN_UP_NOT_ALLOWED"
) {
if (response.status === "SIGN_IN_UP_NOT_ALLOWED") {
return SuperTokens.getInstanceOrThrow().redirectToAuth({
history: props.history,
queryParams: {
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/thirdparty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class Wrapper {
fetchResponse: Response;
}
| {
status: "SIGN_IN_UP_NOT_ALLOWED" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
status: "SIGN_IN_UP_NOT_ALLOWED";
reason: string;
fetchResponse: Response;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/thirdpartyemailpassword/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export default class Wrapper {
fetchResponse: Response;
}
| {
status: "SIGN_IN_UP_NOT_ALLOWED" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
status: "SIGN_IN_UP_NOT_ALLOWED";
reason: string;
fetchResponse: Response;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/thirdpartypasswordless/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class Wrapper {
fetchResponse: Response;
}
| {
status: "SIGN_IN_UP_NOT_ALLOWED" | "EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT";
status: "SIGN_IN_UP_NOT_ALLOWED";
reason: string;
fetchResponse: Response;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
export const package_version = "0.34.1";
export const package_version = "0.35.0";
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertokens-auth-react",
"version": "0.34.1",
"version": "0.35.0",
"description": "ReactJS SDK that provides login functionality with SuperTokens.",
"main": "./index.js",
"engines": {
Expand Down
30 changes: 0 additions & 30 deletions test/end-to-end/accountlinking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,36 +428,6 @@ describe("SuperTokens Account linking", function () {
assert.strictEqual(new URL(page.url()).pathname, "/auth/");
});

it("should not allow sign in w/ passwordless if it conflicts with an unverified user", async function () {
const email = `test-user+${Date.now()}@supertokens.com`;

await setAccountLinkingConfig(true, false);
// 1. Sign up without account linking with an unverified tp user & log out
await tryEmailPasswordSignUp(page, email);
await logOut(page);

// 2. Sign up with passwordless
await tryPasswordlessSignInUp(page, email);
await logOut(page);

await setAccountLinkingConfig(true, true, true);
// 3. Sign in with passwordless
await page.evaluate(() => localStorage.removeItem("supertokens-passwordless-loginAttemptInfo"));
await Promise.all([
page.goto(`${TEST_CLIENT_BASE_URL}/auth/?authRecipe=passwordless`),
page.waitForNavigation({ waitUntil: "networkidle0" }),
]);

await setInputValues(page, [{ name: "emailOrPhone", value: email }]);
await submitForm(page);

assert.strictEqual(
await getGeneralError(page),
"Cannot sign in / up due to security reasons. Please try a different login method or contact support. (ERR_CODE_003)"
);
assert.strictEqual(new URL(page.url()).pathname, "/auth/");
});

it("should not allow sign up w/ passwordless if it conflicts with an unverified user", async function () {
const email = `test-user+${Date.now()}@supertokens.com`;

Expand Down
17 changes: 14 additions & 3 deletions test/end-to-end/multitenancy.tenant_interactions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,14 @@ describe("SuperTokens Multitenancy tenant interactions", function () {
providers: [],
},
});
await setupTenant("customer1", {
emailPassword: { enabled: true },
passwordless: { enabled: false },
thirdParty: {
enabled: true,
providers: [],
},
});

await Promise.all([
page.goto(`${TEST_CLIENT_BASE_URL}${DEFAULT_WEBSITE_BASE_PATH}`),
Expand All @@ -463,7 +471,8 @@ describe("SuperTokens Multitenancy tenant interactions", function () {
const email = await epSignUp(page);

const userId = await getUserIdWithFetch(page);
removeUserFromTenant("public", userId);
await addUserToTenant("customer1", userId);
await removeUserFromTenant("public", userId);

await clearBrowserCookiesWithoutAffectingConsole(page, []);

Expand Down Expand Up @@ -501,7 +510,8 @@ describe("SuperTokens Multitenancy tenant interactions", function () {
const email = await epSignUp(page);

const userId = await getUserIdWithFetch(page);
removeUserFromTenant("public", userId);
await addUserToTenant("customer1", userId);
await removeUserFromTenant("public", userId);
await clearBrowserCookiesWithoutAffectingConsole(page, []);

await Promise.all([
Expand Down Expand Up @@ -540,7 +550,8 @@ describe("SuperTokens Multitenancy tenant interactions", function () {
await epSignUp(page);

const userId = await getUserIdWithFetch(page);
removeUserFromTenant("public", userId);
await addUserToTenant("customer1", userId);
await removeUserFromTenant("public", userId);

await Promise.all([
page.goto(`${TEST_CLIENT_BASE_URL}/dashboard`),
Expand Down

0 comments on commit c58b6e3

Please sign in to comment.