@page "/account/register" @using TrueCV.Web.Components.Layout @layout MainLayout @rendermode InteractiveServer @using Microsoft.AspNetCore.Identity @using TrueCV.Infrastructure.Identity @inject UserManager UserManager @inject SignInManager SignInManager @inject NavigationManager NavigationManager Register - TrueCV

Create Account

Start verifying CVs with confidence

@if (!string.IsNullOrEmpty(_errorMessage)) { }
Password must be at least 6 characters.

Already have an account? Sign in

By creating an account, you agree to our Terms of Service and Privacy Policy
@code { private RegisterModel _model = new(); private bool _isLoading; private string? _errorMessage; private async Task HandleRegister() { _isLoading = true; _errorMessage = null; try { if (_model.Password != _model.ConfirmPassword) { _errorMessage = "Passwords do not match."; _isLoading = false; return; } var user = new ApplicationUser { UserName = _model.Email, Email = _model.Email, Plan = Domain.Enums.UserPlan.Free, ChecksUsedThisMonth = 0 }; var result = await UserManager.CreateAsync(user, _model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent: false); NavigationManager.NavigateTo("/dashboard", forceLoad: true); } else { var errors = result.Errors.Select(e => e.Description); _errorMessage = string.Join(" ", errors); } } catch (Exception ex) { _errorMessage = $"An error occurred: {ex.Message}"; } finally { _isLoading = false; } } private sealed class RegisterModel { [System.ComponentModel.DataAnnotations.Required(ErrorMessage = "Email is required")] [System.ComponentModel.DataAnnotations.EmailAddress(ErrorMessage = "Invalid email format")] public string Email { get; set; } = string.Empty; [System.ComponentModel.DataAnnotations.Required(ErrorMessage = "Password is required")] [System.ComponentModel.DataAnnotations.MinLength(6, ErrorMessage = "Password must be at least 6 characters")] public string Password { get; set; } = string.Empty; [System.ComponentModel.DataAnnotations.Required(ErrorMessage = "Please confirm your password")] [System.ComponentModel.DataAnnotations.Compare(nameof(Password), ErrorMessage = "Passwords do not match")] public string ConfirmPassword { get; set; } = string.Empty; } }