diff --git a/Wave/Components/Account/Pages/Register.razor b/Wave/Components/Account/Pages/Register.razor index 8cd227f..f90d9d2 100644 --- a/Wave/Components/Account/Pages/Register.razor +++ b/Wave/Components/Account/Pages/Register.razor @@ -14,37 +14,39 @@ @inject ILogger Logger @inject NavigationManager NavigationManager @inject IdentityRedirectManager RedirectManager +@inject IStringLocalizer Localizer -Register +@Localizer["Title"] -

Register

- -
-
- - + +
+
+

@Localizer["Title"]

+ -

Create a new account.

-
- -
- - - -
-
- - - -
-
- - - -
- + + + + + + + + + + + +
-
+ +
@code { - private IEnumerable? identityErrors; + private IEnumerable? _identityErrors; - [SupplyParameterFromForm] + [SupplyParameterFromForm] private InputModel Input { get; set; } = new(); - [SupplyParameterFromQuery] + [SupplyParameterFromQuery] private string? ReturnUrl { get; set; } - private string? Message => identityErrors is null ? null : $"Error: {string.Join(", ", identityErrors.Select(error => error.Description))}"; + private string? Message => + _identityErrors is null ? null : + $"Error: {string.Join(", ", _identityErrors.Select(error => error.Description))}"; - public async Task RegisterUser(EditContext editContext) - { + public async Task RegisterUser(EditContext editContext) { var user = CreateUser(); await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None); @@ -74,9 +78,8 @@ await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None); var result = await UserManager.CreateAsync(user, Input.Password); - if (!result.Succeeded) - { - identityErrors = result.Errors; + if (!result.Succeeded) { + _identityErrors = result.Errors; return; } @@ -91,8 +94,7 @@ await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl)); - if (UserManager.Options.SignIn.RequireConfirmedAccount) - { + if (UserManager.Options.SignIn.RequireConfirmedAccount) { RedirectManager.RedirectTo( "Account/RegisterConfirmation", new() { ["email"] = Input.Email, ["returnUrl"] = ReturnUrl }); @@ -102,30 +104,25 @@ RedirectManager.RedirectTo(ReturnUrl); } - private ApplicationUser CreateUser() - { - try - { + private ApplicationUser CreateUser() { + try { return Activator.CreateInstance(); - } - catch - { - throw new InvalidOperationException($"Can't create an instance of '{nameof(ApplicationUser)}'. " + + } catch { + throw new InvalidOperationException( + $"Can't create an instance of '{nameof(ApplicationUser)}'. " + $"Ensure that '{nameof(ApplicationUser)}' is not an abstract class and has a parameterless constructor."); } } - private IUserEmailStore GetEmailStore() - { - if (!UserManager.SupportsUserEmail) - { + private IUserEmailStore GetEmailStore() { + if (!UserManager.SupportsUserEmail) { throw new NotSupportedException("The default UI requires a user store with email support."); } + return (IUserEmailStore)UserStore; } - private sealed class InputModel - { + private sealed class InputModel { [Required] [EmailAddress] [Display(Name = "Email")] @@ -142,4 +139,5 @@ [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } = ""; } + } diff --git a/Wave/Resources/Components/Account/Pages/Register.de-DE.resx b/Wave/Resources/Components/Account/Pages/Register.de-DE.resx new file mode 100644 index 0000000..f320403 --- /dev/null +++ b/Wave/Resources/Components/Account/Pages/Register.de-DE.resx @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Registrieren + + + Jetzt Registrieren + + + E-Mail + + + Passwort + + + Passwort wiederholen + + + Passwort + + + Passwort + + \ No newline at end of file diff --git a/Wave/Resources/Components/Account/Pages/Register.en-GB.resx b/Wave/Resources/Components/Account/Pages/Register.en-GB.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/Wave/Resources/Components/Account/Pages/Register.en-GB.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Wave/Resources/Components/Account/Pages/Register.resx b/Wave/Resources/Components/Account/Pages/Register.resx new file mode 100644 index 0000000..0ee7d9e --- /dev/null +++ b/Wave/Resources/Components/Account/Pages/Register.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Sign Up + + + Email + + + name@example.com + + + Password + + + Password + + + Repeat password + + + Password + + + Sign Up Now + + \ No newline at end of file