@page "/register" @inject IAccountManagement Acct

Register

You're already logged in as @context.User.Identity?.Name.
@if (showNextSteps) {

Thank you for joining! You will receive an email asking to confirm you own this email address.

} @if (errorList.Length > 0) {
    @foreach (var error in errorList) {
  • @error
  • }
}
@code { private bool showNextSteps; private string email = string.Empty; private string password = string.Empty; private string confirmPassword = string.Empty; private string[] errorList = []; public async Task DoRegisterAsync() { errorList = []; if (string.IsNullOrWhiteSpace(email)) { errorList = ["Email is required."]; return; } if (string.IsNullOrWhiteSpace(password)) { errorList = ["Password is required."]; return; } if (string.IsNullOrWhiteSpace(confirmPassword)) { errorList = ["Please confirm your password."]; return; } if (password != confirmPassword) { errorList = ["Passwords don't match."]; return; } var result = await Acct.RegisterAsync(email, password); if (result.Succeeded) { email = password = confirmPassword = string.Empty; showNextSteps = true; } else { errorList = result.ErrorList; } } }