Skip to content

Add Optional Built-in Email Format Validation in Identity UserManager #62437

Closed as not planned
@SaleemAdhamKassab

Description

@SaleemAdhamKassab

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Is your feature request related to a problem?

Yes. ASP.NET Core Identity allows storing any string in the Email field (even invalid formats like "abc") when creating a user via UserManager.CreateAsync. This can lead to inconsistent data or bugs if developers forget to validate input.

Describe the solution you'd like

Please consider adding an optional setting to IdentityOptions like:

options.User.RequireValidEmailFormat = true;

Describe the solution you'd like

Manually validating using [EmailAddress] data annotation in DTOs

Adding runtime checks in controllers or services

Adding CHECK constraint at database level

All of these work, but having a built-in option would reduce common mistakes and improve developer experience.

Additional context

This has been encountered during production testing, where users were saved with invalid email formats without errors. Adding a default or optional validation would help developers catch these issues earlier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions