Skip to content

Prefill admin email and make it mandatory#2681

Open
bcotrim wants to merge 2 commits intotrunkfrom
prefill-admin-email-default
Open

Prefill admin email and make it mandatory#2681
bcotrim wants to merge 2 commits intotrunkfrom
prefill-admin-email-default

Conversation

@bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Feb 27, 2026

Related issues

Related to #2527 (Add support for Blueprints login)

Proposed Changes

  • Prefill the admin email field with admin@localhost.com instead of leaving it empty
  • Make email validation mandatory (always enabled, not conditional on user input)
  • Remove the informational comment explaining the default value
  • For pre-existing sites without a stored email, automatically fetch it from WordPress via wp user get <username> --field=user_email when opening site settings (uses the stored admin username or defaults to admin)
  • Simplify form submission logic to always send the email value (since it's now always populated)

Testing Instructions

For new sites:

  1. Create a new site
  2. In the advanced settings, verify the email field is prefilled with admin@localhost.com
  3. Try to clear the field and save — should show validation error "Admin email cannot be empty."
  4. Enter a valid email and confirm the site is created

For pre-existing sites:

  1. If you have a site created before PR Add support for Blueprints login #2527 without stored email:
    • Open its settings
    • Watch the email field populate with the real email from WordPress (fetched via WP-CLI)
  2. Edit the email and save — should persist to appdata

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Prefill the email field with 'admin@localhost.com' instead of leaving it empty.
For pre-existing sites without a stored email, fetch it from WordPress via
'wp user get <username> --field=user_email'. Make the field mandatory with
always-on validation. Remove the help text comment about defaults.
@bcotrim bcotrim self-assigned this Feb 27, 2026
@bcotrim bcotrim requested review from a team and wojtekn February 27, 2026 13:49
@bcotrim bcotrim mentioned this pull request Feb 27, 2026
12 tasks
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 27, 2026

📊 Performance Test Results

Comparing 60442fa vs trunk

site-editor

Metric trunk 60442fa Diff Change
load 1507.00 ms 1445.00 ms -62.00 ms 🟢 -4.1%

site-startup

Metric trunk 60442fa Diff Change
siteCreation 7080.00 ms 7111.00 ms +31.00 ms ⚪ 0.0%
siteStartup 4932.00 ms 4944.00 ms +12.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

Thanks @bcotrim for improving this! 🙌 This is looking good to me, and tests well. Unfortunately I didn't have a site from earlier, but I confirm the validation works great for a new site:

CleanShot.2026-02-27.at.15.26.39.mp4

Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

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

Thanks @bcotrim! I have tested it, and I see the email validation when creating the site and when deleting the email from an existing (or new) site. LGTM!

One small detail that can be tacked as a follow-up is that the validation message displayed when editing a site and deleting the email is hidden from the viewport and the user needs to scroll down. Initially, I saw the red outline but didn't see the message, then I realised I needed to scroll, please see the video below

CleanShot.2026-02-27.at.17.49.57.mp4

This is such a minor detail, but I believe addressing it will enhance the validation UX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants