This guide explains how to remove the registration approval workflow, allowing users to access the application immediately after registering.
The simplest approach is to disable approval in configuration:
"Registration": {
"AllowSelfRegistration": true,
"RequireApproval": false // Users can log in immediately
}
In appsettings.json, remove the RequireApproval setting:
"Registration": {
"AllowSelfRegistration": true
// DELETE: "RequireApproval": true/false
}
Delete the entire Pages/Admin/PendingUsers/ folder:
Index.cshtml and .cshtml.csReview.cshtml and .cshtml.csDelete from Pages/Account/:
RegistrationPending.cshtml and .cshtml.csIn Pages/Account/Register.cshtml.cs, remove approval-related code:
// DELETE: Approval check
var requireApproval = _configuration.GetValue<bool>("Registration:RequireApproval");
if (requireApproval)
{
user.PendingApproval = true;
// ... approval logic
}
// KEEP only the direct login logic
In Pages/Account/Login.cshtml.cs, remove the pending approval check:
// DELETE: Pending approval check
if (user.PendingApproval)
{
ModelState.AddModelError(string.Empty, "Your registration is pending approval.");
return Page();
}
In Pages/Admin/Index.cshtml, remove the Pending Users link and count:
<!-- DELETE: Pending Users card/link -->
<div class="card">
<div class="card-body">
<h5>Pending Users</h5>
...
</div>
</div>
Search for and remove email sending code related to:
The PendingApproval column in AspNetUsers can remain, but you may
want to create a migration to remove it:
// In Package Manager Console:
Add-Migration RemovePendingApproval
// In the migration Up() method:
migrationBuilder.DropColumn(
name: "PendingApproval",
table: "AspNetUsers");
After removal, verify: