docs: adds notes about importance of serverURL for verify / forgot-pa… (#10248)

Fixes #10235
This commit is contained in:
James Mikrut
2024-12-30 10:20:28 -05:00
committed by GitHub
parent 363a24cea5
commit 6af6e44683
7 changed files with 14 additions and 10 deletions

View File

@@ -269,9 +269,9 @@ const result = await payload.verifyEmail({
})
```
Note that the token you need to pass to the `verifyEmail` function is unique to verification and is not the same as the token that you can retrieve from the `forgotPassword` operation. It can be found on the user document, as a hidden `_verificationToken` field.
**Note:** the token you need to pass to the `verifyEmail` function is unique to verification and is not the same as the token that you can retrieve from the `forgotPassword` operation. It can be found on the user document, as a hidden `_verificationToken` field. If you'd like to retrieve this token, you can use the Local API's `find` or `findByID` methods, setting `showHiddenFields: true`.
If you'd like to retrieve this token, you can use the Local API's `find` or `findByID` methods, setting `showHiddenFields: true`.
**Note:** if you do not have a `config.serverURL` set, Payload will attempt to create one for you if the user was created via REST or GraphQL by looking at the incoming `req`. But this is not supported if you are creating the user via the Local API's `payload.create()` method. If this applies to you, and you do not have a `serverURL` set, you may want to override your `verify.generateEmailHTML` function to provide a full URL to link the user to a proper verification page.
## Unlock
@@ -348,6 +348,8 @@ const token = await payload.forgotPassword({
})
```
**Note:** if you do not have a `config.serverURL` set, Payload will attempt to create one for you if the `forgot-password` operation was triggered via REST or GraphQL by looking at the incoming `req`. But this is not supported if you are calling `payload.forgotPassword()` via the Local API. If you do not have a `serverURL` set, you may want to override your `auth.forgotPassword.generateEmailHTML` function to provide a full URL to link the user to a proper reset-password page.
<Banner type="success">
**Tip:**

View File

@@ -106,7 +106,6 @@ _\* An asterisk denotes that a property is required._
Some properties are removed from the client-side bundle. [More details](../admin/components#accessing-the-payload-config).
</Banner>
### Typescript Config
Payload exposes a variety of TypeScript settings that you can leverage. These settings are used to auto-generate TypeScript interfaces for your [Collections](../configuration/collections) and [Globals](../configuration/globals), and to ensure that Payload uses your [Generated Types](../typescript/overview) for all [Local API](../local-api/overview) methods.

View File

@@ -13,9 +13,9 @@ import { BannerBlock } from '../../mdx/jsxBlocks/banner.js'
import { CodeBlock } from '../../mdx/jsxBlocks/code/code.js'
import { InlineCodeBlock } from '../../mdx/jsxBlocks/inlineCode.js'
import { PackageInstallOptions } from '../../mdx/jsxBlocks/packageInstallOptions.js'
import { RestExamplesBlock } from '../../mdx/jsxBlocks/restExamples/index.js'
import { TextContainerBlock } from '../../mdx/jsxBlocks/TextContainer.js'
import { TextContainerNoTrimBlock } from '../../mdx/jsxBlocks/TextContainerNoTrim.js'
import { RestExamplesBlock } from '../../mdx/jsxBlocks/restExamples/index.js'
export const postsSlug = 'posts'

View File

@@ -44,4 +44,4 @@
}
},
"frontMatter": []
}
}

View File

@@ -1,5 +1,6 @@
import { tableJson } from '../tableJson.js'
import type { Test } from '../int.spec.js'
import { tableJson } from '../tableJson.js'
import { textToRichText } from '../textToRichText.js'
export const defaultTests: Test[] = [

View File

@@ -1,7 +1,8 @@
import { readFileSync } from 'fs'
import type { Test } from '../int.spec.js'
import { fileURLToPath } from 'url'
import path from 'path'
import { fileURLToPath } from 'url'
import type { Test } from '../int.spec.js'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)

View File

@@ -1,7 +1,8 @@
import { readFileSync } from 'fs'
import type { Test } from '../int.spec.js'
import { fileURLToPath } from 'url'
import path from 'path'
import { fileURLToPath } from 'url'
import type { Test } from '../int.spec.js'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)