Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updates custom framework to following correct CollectingResponse flow order (to ensure that subsequent calls to the `sendJSONResponse` doesn't overwrite the response).
- Updated/expanded plugin support.
- Reworked internals to avoid dynamic requires and circular dependencies
- Fix signup error when a form field value is null

## [23.0.1] - 2025-07-31

Expand Down
12 changes: 6 additions & 6 deletions lib/build/recipe/emailpassword/api/utils.js

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

12 changes: 6 additions & 6 deletions lib/ts/recipe/emailpassword/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ async function validateFormOrThrowError(

// Add the not optional error if input is not passed
// and the field is not optional.
const isValidInput =
!!input &&
((typeof input.value === "string"
? input.value.length > 0
: input.value !== null && typeof input.value !== "undefined") ||
(typeof input.value === "object" && Object.values(input.value).length > 0));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The (typeof input.value === "object" && Object.values(input.value).length > 0) branch looks like dead code. An empty object as a form field value evaluates as true by input.value !== null && typeof input.value !== "undefined") short-circuiting the check before it reaches line 117.

const hasNonEmptyStringValue = typeof input?.value === "string" && input.value.length > 0;
const hasNonNullishNonStringValue =
typeof input?.value !== "string" && input?.value !== null && input?.value !== undefined;

const isValidInput = !!input && (hasNonEmptyStringValue || hasNonNullishNonStringValue);

if (!formField.optional && !isValidInput) {
validationErrors.push({
error: "Field is not optional",
Expand Down