From 6af6e446834ace19651773475702bc64b7d011b6 Mon Sep 17 00:00:00 2001 From: James Mikrut Date: Mon, 30 Dec 2024 10:20:28 -0500 Subject: [PATCH] =?UTF-8?q?docs:=20adds=20notes=20about=20importance=20of?= =?UTF-8?q?=20serverURL=20for=20verify=20/=20forgot-pa=E2=80=A6=20(#10248)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #10235 --- docs/authentication/operations.mdx | 6 ++++-- docs/configuration/overview.mdx | 1 - test/lexical-mdx/collections/Posts/index.ts | 2 +- test/lexical-mdx/result.json | 2 +- test/lexical-mdx/tests/default.test.ts | 3 ++- test/lexical-mdx/tests/restExamples.test.ts | 5 +++-- test/lexical-mdx/tests/restExamples2.test.ts | 5 +++-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/authentication/operations.mdx b/docs/authentication/operations.mdx index ad8248db77..7f3a02b575 100644 --- a/docs/authentication/operations.mdx +++ b/docs/authentication/operations.mdx @@ -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. + **Tip:** diff --git a/docs/configuration/overview.mdx b/docs/configuration/overview.mdx index 373ff60f24..d304da7f2d 100644 --- a/docs/configuration/overview.mdx +++ b/docs/configuration/overview.mdx @@ -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). - ### 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. diff --git a/test/lexical-mdx/collections/Posts/index.ts b/test/lexical-mdx/collections/Posts/index.ts index 5aa80dad98..7cfcb10d5c 100644 --- a/test/lexical-mdx/collections/Posts/index.ts +++ b/test/lexical-mdx/collections/Posts/index.ts @@ -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' diff --git a/test/lexical-mdx/result.json b/test/lexical-mdx/result.json index a6583c1b0f..5528730b5e 100644 --- a/test/lexical-mdx/result.json +++ b/test/lexical-mdx/result.json @@ -44,4 +44,4 @@ } }, "frontMatter": [] -} \ No newline at end of file +} diff --git a/test/lexical-mdx/tests/default.test.ts b/test/lexical-mdx/tests/default.test.ts index 0c349c81f3..d93e4eca84 100644 --- a/test/lexical-mdx/tests/default.test.ts +++ b/test/lexical-mdx/tests/default.test.ts @@ -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[] = [ diff --git a/test/lexical-mdx/tests/restExamples.test.ts b/test/lexical-mdx/tests/restExamples.test.ts index 1b9935bd6b..8c38a23731 100644 --- a/test/lexical-mdx/tests/restExamples.test.ts +++ b/test/lexical-mdx/tests/restExamples.test.ts @@ -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) diff --git a/test/lexical-mdx/tests/restExamples2.test.ts b/test/lexical-mdx/tests/restExamples2.test.ts index 6a3236e80f..987c9a4832 100644 --- a/test/lexical-mdx/tests/restExamples2.test.ts +++ b/test/lexical-mdx/tests/restExamples2.test.ts @@ -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)