Skip to content

Commit

Permalink
fixes email verification docs flow
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Jul 20, 2024
1 parent 815e7e1 commit 16e66a9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 380 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import VueUIImplementation from "/src/components/reusableSnippets/vueUIImplement

# Enable email verification

## Enable email verification

:::important
Email verification is turned off by default. It is strongly encouraged to enable it to ensure the authenticity of your users.
:::

<PreBuiltOrCustomUISwitcher>

<PreBuiltUIContent>

There are two modes of email verification:

- `REQUIRED`: Requires that the user's email is verified before they can access your application's frontend or backend routes (that are protected with a session).
Expand Down Expand Up @@ -113,10 +115,6 @@ init(

### Frontend setup

<PreBuiltOrCustomUISwitcher>

<PreBuiltUIContent>

<FrontendPreBuiltUITabs>

<TabItem value="reactjs">
Expand Down Expand Up @@ -227,76 +225,7 @@ Additionally, note that SuperTokens does not send verification emails post user

<CustomUIContent>

<FrontendCustomUITabs>
<TabItem value="web">

<NpmOrScriptTabs>
<TabItem value="npm">

```tsx
import SuperTokens from "supertokens-web-js";
import EmailVerification from "supertokens-web-js/recipe/emailverification";
import Session from "supertokens-web-js/recipe/session";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
// highlight-start
EmailVerification.init(),
Session.init(),
],
});
```

</TabItem>
<TabItem value="script">

Add the following `<script>` element along with the other ones in your app

```bash
# ...other script tags in the frontend init section
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/emailverification.js"></script>
```

Then call the `supertokensEmailVerification.init` function as shown below

```tsx
import supertokens from "supertokens-web-js-script";
import supertokensEmailVerification from "supertokens-web-js-script/recipe/emailverification";
import supertokensSession from "supertokens-web-js-script/recipe/session";
supertokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
// highlight-start
supertokensEmailVerification.init(),
supertokensSession.init(),
],
});
```

</TabItem>
</NpmOrScriptTabs>

</TabItem>

<TabItem value="mobile">

:::success
No specific action required here.
:::

</TabItem>
</FrontendCustomUITabs>

:::important
SuperTokens will not send the verification email post user signup. You will need to call the email verification API to send the email. Our guide on [protecting API and website routes](./protecting-routes) will go over the changes that need to be made to send the verification email.
:::
See our guide [in the custom UI section](../../custom-ui/enable-email-verification).

</CustomUIContent>

Expand Down
81 changes: 5 additions & 76 deletions v2/passwordless/common-customizations/email-verification/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import VueUIImplementation from "/src/components/reusableSnippets/vueUIImplement

# Enable email verification

## Enable email verification

:::important
Email verification is turned off by default. It is strongly encouraged to enable it to ensure the authenticity of your users.
:::

<PreBuiltOrCustomUISwitcher>

<PreBuiltUIContent>

There are two modes of email verification:

- `REQUIRED`: Requires that the user's email is verified before they can access your application's frontend or backend routes (that are protected with a session).
Expand Down Expand Up @@ -113,10 +115,6 @@ init(

### Frontend setup

<PreBuiltOrCustomUISwitcher>

<PreBuiltUIContent>

<FrontendPreBuiltUITabs>

<TabItem value="reactjs">
Expand Down Expand Up @@ -227,76 +225,7 @@ Additionally, note that SuperTokens does not send verification emails post user

<CustomUIContent>

<FrontendCustomUITabs>
<TabItem value="web">

<NpmOrScriptTabs>
<TabItem value="npm">

```tsx
import SuperTokens from "supertokens-web-js";
import EmailVerification from "supertokens-web-js/recipe/emailverification";
import Session from "supertokens-web-js/recipe/session";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
// highlight-start
EmailVerification.init(),
Session.init(),
],
});
```

</TabItem>
<TabItem value="script">

Add the following `<script>` element along with the other ones in your app

```bash
# ...other script tags in the frontend init section
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/emailverification.js"></script>
```

Then call the `supertokensEmailVerification.init` function as shown below

```tsx
import supertokens from "supertokens-web-js-script";
import supertokensEmailVerification from "supertokens-web-js-script/recipe/emailverification";
import supertokensSession from "supertokens-web-js-script/recipe/session";
supertokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
// highlight-start
supertokensEmailVerification.init(),
supertokensSession.init(),
],
});
```

</TabItem>
</NpmOrScriptTabs>

</TabItem>

<TabItem value="mobile">

:::success
No specific action required here.
:::

</TabItem>
</FrontendCustomUITabs>

:::important
SuperTokens will not send the verification email post user signup. You will need to call the email verification API to send the email. Our guide on [protecting API and website routes](./protecting-routes) will go over the changes that need to be made to send the verification email.
:::
See our guide [in the custom UI section](../../custom-ui/enable-email-verification).

</CustomUIContent>

Expand Down
81 changes: 5 additions & 76 deletions v2/thirdparty/common-customizations/email-verification/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import VueUIImplementation from "/src/components/reusableSnippets/vueUIImplement

# Enable email verification

## Enable email verification

:::important
Email verification is turned off by default. It is strongly encouraged to enable it to ensure the authenticity of your users.
:::

<PreBuiltOrCustomUISwitcher>

<PreBuiltUIContent>

There are two modes of email verification:

- `REQUIRED`: Requires that the user's email is verified before they can access your application's frontend or backend routes (that are protected with a session).
Expand Down Expand Up @@ -113,10 +115,6 @@ init(

### Frontend setup

<PreBuiltOrCustomUISwitcher>

<PreBuiltUIContent>

<FrontendPreBuiltUITabs>

<TabItem value="reactjs">
Expand Down Expand Up @@ -227,76 +225,7 @@ Additionally, note that SuperTokens does not send verification emails post user

<CustomUIContent>

<FrontendCustomUITabs>
<TabItem value="web">

<NpmOrScriptTabs>
<TabItem value="npm">

```tsx
import SuperTokens from "supertokens-web-js";
import EmailVerification from "supertokens-web-js/recipe/emailverification";
import Session from "supertokens-web-js/recipe/session";

SuperTokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
// highlight-start
EmailVerification.init(),
Session.init(),
],
});
```

</TabItem>
<TabItem value="script">

Add the following `<script>` element along with the other ones in your app

```bash
# ...other script tags in the frontend init section
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/emailverification.js"></script>
```

Then call the `supertokensEmailVerification.init` function as shown below

```tsx
import supertokens from "supertokens-web-js-script";
import supertokensEmailVerification from "supertokens-web-js-script/recipe/emailverification";
import supertokensSession from "supertokens-web-js-script/recipe/session";
supertokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
},
recipeList: [
// highlight-start
supertokensEmailVerification.init(),
supertokensSession.init(),
],
});
```

</TabItem>
</NpmOrScriptTabs>

</TabItem>

<TabItem value="mobile">

:::success
No specific action required here.
:::

</TabItem>
</FrontendCustomUITabs>

:::important
SuperTokens will not send the verification email post user signup. You will need to call the email verification API to send the email. Our guide on [protecting API and website routes](./protecting-routes) will go over the changes that need to be made to send the verification email.
:::
See our guide [in the custom UI section](../../custom-ui/enable-email-verification).

</CustomUIContent>

Expand Down
Loading

0 comments on commit 16e66a9

Please sign in to comment.