Skip to content

Commit

Permalink
docs: adds notes about importance of serverURL for verify / forgot-pa… (
Browse files Browse the repository at this point in the history
#10248)

Fixes #10235
  • Loading branch information
jmikrut authored Dec 30, 2024
1 parent 363a24c commit 6af6e44
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions docs/authentication/operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:**

Expand Down
1 change: 0 additions & 1 deletion docs/configuration/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/lexical-mdx/collections/Posts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion test/lexical-mdx/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
}
},
"frontMatter": []
}
}
3 changes: 2 additions & 1 deletion test/lexical-mdx/tests/default.test.ts
Original file line number Diff line number Diff line change
@@ -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[] = [
Expand Down
5 changes: 3 additions & 2 deletions test/lexical-mdx/tests/restExamples.test.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
5 changes: 3 additions & 2 deletions test/lexical-mdx/tests/restExamples2.test.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 6af6e44

Please sign in to comment.