Skip to content

[PM-36014] - Enhanced Invite Validation#855

Open
jrmccannon wants to merge 7 commits into
mainfrom
jmccannon/pwl/pm-36014-validate-invite
Open

[PM-36014] - Enhanced Invite Validation#855
jrmccannon wants to merge 7 commits into
mainfrom
jmccannon/pwl/pm-36014-validate-invite

Conversation

@jrmccannon
Copy link
Copy Markdown
Contributor

@jrmccannon jrmccannon commented May 5, 2026

Ticket

PM-36014

Description

This adds additional validation around invites and joining an organization. Also added additional clean-up around expired invites.

@jrmccannon jrmccannon requested a review from a team as a code owner May 5, 2026 16:27
@jrmccannon jrmccannon added the ai-review Request a Claude code review label May 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 90.62500% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.19%. Comparing base (d89745f) to head (e6158ce).

Files with missing lines Patch % Lines
src/AdminConsole/Pages/Organization/Join.cshtml.cs 84.61% 1 Missing and 1 partial ⚠️
src/AdminConsole/Services/InvitationService.cs 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #855      +/-   ##
==========================================
+ Coverage   36.87%   37.19%   +0.32%     
==========================================
  Files         586      587       +1     
  Lines       31478    31492      +14     
  Branches      904      904              
==========================================
+ Hits        11606    11715     +109     
+ Misses      19724    19625      -99     
- Partials      148      152       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jrmccannon jrmccannon requested a review from abergs May 7, 2026 14:35
!await _invitationService.ConsumeInviteAsync(invite))
{
_eventLogger.LogAdminInvalidInviteUsedEvent(invite, _timeProvider.GetUtcNow().UtcDateTime);
ModelState.AddModelError("bad-invite", "Invite is invalid or expired");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would a lower surface area fix be:

A) Properly return Page() in this failure mode
B) Have ConsumeInviteAsync clear expired codes?

return Page();
}

ConsoleAdmin? existingUser = await _userManager.FindByEmailAsync(form.Email);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think allowing changing the Email used when signing up was intentional, but we could swap to use the invited email to harden this surface a bit.

# Conflicts:
#	tests/AdminConsole.Tests/AdminConsole.Tests.csproj
@jrmccannon jrmccannon requested a review from abergs May 15, 2026 19:06
abergs
abergs previously approved these changes May 18, 2026
<label asp-for="Form.Name" class="block text-sm font-medium leading-6 text-gray-900">Admin Name</label>
<div class="mt-2">
<input placeholder="Philip J. Fry" type="text" asp-for="Form.Name" class="text-input">
<input type="text" asp-for="Form.Name" class="text-input">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

keep placeholder for name?

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

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants