diff --git a/CouchLog/Components/Account/Pages/ExternalLogin.razor b/CouchLog/Components/Account/Pages/ExternalLogin.razor index e803dd1..bf24ccd 100644 --- a/CouchLog/Components/Account/Pages/ExternalLogin.razor +++ b/CouchLog/Components/Account/Pages/ExternalLogin.razor @@ -54,7 +54,7 @@ private HttpContext HttpContext { get; set; } = default!; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; [SupplyParameterFromQuery] private string? RemoteError { get; set; } @@ -94,6 +94,8 @@ // the login page if we get here some other way. RedirectManager.RedirectTo("Account/Login"); } + + Input ??= new InputModel(); } private async Task OnLoginCallbackAsync() diff --git a/CouchLog/Components/Account/Pages/ForgotPassword.razor b/CouchLog/Components/Account/Pages/ForgotPassword.razor index 8cbe591..29cf4ad 100644 --- a/CouchLog/Components/Account/Pages/ForgotPassword.razor +++ b/CouchLog/Components/Account/Pages/ForgotPassword.razor @@ -35,7 +35,7 @@ @code { [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; private async Task OnValidSubmitAsync() { diff --git a/CouchLog/Components/Account/Pages/Login.razor b/CouchLog/Components/Account/Pages/Login.razor index b02b6e7..303f8d1 100644 --- a/CouchLog/Components/Account/Pages/Login.razor +++ b/CouchLog/Components/Account/Pages/Login.razor @@ -31,7 +31,7 @@ @* MudTextFields zwingend mit Name-Attribut für SSR *@ Logger +@inject ISnackbar Snackbar Change password -

Change password

- -
-
- - - -
- - - -
-
- - - -
-
- - - -
- -
-
-
+Change password + + + + + + + + + + Change password + @code { - private string? message; - private ApplicationUser user = default!; - private bool hasPassword; + private ApplicationUser _user = null!; + private bool _hasPassword; [CascadingParameter] - private HttpContext HttpContext { get; set; } = default!; + private HttpContext HttpContext { get; set; } = null!; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; protected override async Task OnInitializedAsync() { - user = await UserAccessor.GetRequiredUserAsync(HttpContext); - hasPassword = await UserManager.HasPasswordAsync(user); - if (!hasPassword) + _user = await UserAccessor.GetRequiredUserAsync(HttpContext); + _hasPassword = await UserManager.HasPasswordAsync(_user); + if (!_hasPassword) { RedirectManager.RedirectTo("Account/Manage/SetPassword"); } + Input ??= new InputModel(); } private async Task OnValidSubmitAsync() { - var changePasswordResult = await UserManager.ChangePasswordAsync(user, Input.OldPassword, Input.NewPassword); + var changePasswordResult = await UserManager.ChangePasswordAsync(_user, Input.OldPassword, Input.NewPassword); if (!changePasswordResult.Succeeded) { - message = $"Error: {string.Join(",", changePasswordResult.Errors.Select(error => error.Description))}"; + return; } - await SignInManager.RefreshSignInAsync(user); + await SignInManager.RefreshSignInAsync(_user); Logger.LogInformation("User changed their password successfully."); RedirectManager.RedirectToCurrentPageWithStatus("Your password has been changed", HttpContext); diff --git a/CouchLog/Components/Account/Pages/Manage/DeletePersonalData.razor b/CouchLog/Components/Account/Pages/Manage/DeletePersonalData.razor index 8fb6331..438b8d9 100644 --- a/CouchLog/Components/Account/Pages/Manage/DeletePersonalData.razor +++ b/CouchLog/Components/Account/Pages/Manage/DeletePersonalData.razor @@ -47,13 +47,15 @@ private HttpContext HttpContext { get; set; } = default!; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; protected override async Task OnInitializedAsync() { Input ??= new(); user = await UserAccessor.GetRequiredUserAsync(HttpContext); requirePassword = await UserManager.HasPasswordAsync(user); + + Input ??= new InputModel(); } private async Task OnValidSubmitAsync() diff --git a/CouchLog/Components/Account/Pages/Manage/Email.razor b/CouchLog/Components/Account/Pages/Manage/Email.razor index 2115d77..b64a040 100644 --- a/CouchLog/Components/Account/Pages/Manage/Email.razor +++ b/CouchLog/Components/Account/Pages/Manage/Email.razor @@ -63,7 +63,7 @@ private HttpContext HttpContext { get; set; } = default!; [SupplyParameterFromForm(FormName = "change-email")] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; protected override async Task OnInitializedAsync() { @@ -72,6 +72,7 @@ isEmailConfirmed = await UserManager.IsEmailConfirmedAsync(user); Input.NewEmail ??= email; + Input ??= new InputModel(); } private async Task OnValidSubmitAsync() diff --git a/CouchLog/Components/Account/Pages/Manage/EnableAuthenticator.razor b/CouchLog/Components/Account/Pages/Manage/EnableAuthenticator.razor index 6004d0d..ad5f478 100644 --- a/CouchLog/Components/Account/Pages/Manage/EnableAuthenticator.razor +++ b/CouchLog/Components/Account/Pages/Manage/EnableAuthenticator.razor @@ -79,7 +79,7 @@ else private HttpContext HttpContext { get; set; } = default!; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; protected override async Task OnInitializedAsync() { diff --git a/CouchLog/Components/Account/Pages/Manage/Index.razor b/CouchLog/Components/Account/Pages/Manage/Index.razor index 54edfd9..50c4c6f 100644 --- a/CouchLog/Components/Account/Pages/Manage/Index.razor +++ b/CouchLog/Components/Account/Pages/Manage/Index.razor @@ -11,27 +11,14 @@ Profile -

Profile

+Profile -
-
- - - -
- - -
- -
-
-
+ + + + + @code { private ApplicationUser user = default!; @@ -42,7 +29,7 @@ private HttpContext HttpContext { get; set; } = default!; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; protected override async Task OnInitializedAsync() { diff --git a/CouchLog/Components/Account/Pages/Manage/SetPassword.razor b/CouchLog/Components/Account/Pages/Manage/SetPassword.razor index 5ccd8ba..5087f38 100644 --- a/CouchLog/Components/Account/Pages/Manage/SetPassword.razor +++ b/CouchLog/Components/Account/Pages/Manage/SetPassword.razor @@ -45,7 +45,7 @@ private HttpContext HttpContext { get; set; } = default!; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; protected override async Task OnInitializedAsync() { diff --git a/CouchLog/Components/Account/Pages/Register.razor b/CouchLog/Components/Account/Pages/Register.razor index 8ca9662..20154fe 100644 --- a/CouchLog/Components/Account/Pages/Register.razor +++ b/CouchLog/Components/Account/Pages/Register.razor @@ -59,7 +59,7 @@ private IEnumerable? identityErrors; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; [SupplyParameterFromQuery] private string? ReturnUrl { get; set; } diff --git a/CouchLog/Components/Account/Pages/ResendEmailConfirmation.razor b/CouchLog/Components/Account/Pages/ResendEmailConfirmation.razor index 69a5d36..83999e6 100644 --- a/CouchLog/Components/Account/Pages/ResendEmailConfirmation.razor +++ b/CouchLog/Components/Account/Pages/ResendEmailConfirmation.razor @@ -37,7 +37,7 @@ private string? message; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; private async Task OnValidSubmitAsync() { diff --git a/CouchLog/Components/Account/Pages/ResetPassword.razor b/CouchLog/Components/Account/Pages/ResetPassword.razor index e1754f9..b83d72d 100644 --- a/CouchLog/Components/Account/Pages/ResetPassword.razor +++ b/CouchLog/Components/Account/Pages/ResetPassword.razor @@ -46,7 +46,7 @@ private IEnumerable? identityErrors; [SupplyParameterFromForm] - private InputModel Input { get; set; } = new(); + private InputModel Input { get; set; } = null!; [SupplyParameterFromQuery] private string? Code { get; set; } diff --git a/CouchLog/Components/Account/Shared/ManageLayout.razor b/CouchLog/Components/Account/Shared/ManageLayout.razor index bdd73a8..dfca18c 100644 --- a/CouchLog/Components/Account/Shared/ManageLayout.razor +++ b/CouchLog/Components/Account/Shared/ManageLayout.razor @@ -1,17 +1,18 @@ @inherits LayoutComponentBase @layout CouchLog.Components.Layout.MainLayout -

Manage your account

+Manage your account -
-

Change your account settings

-
-
-
- -
-
+ + Change your account settings +
+ + + + + + @Body -
-
-
+ + + \ No newline at end of file diff --git a/CouchLog/Components/Account/Shared/ManageNavMenu.razor b/CouchLog/Components/Account/Shared/ManageNavMenu.razor index e6c1413..8f01db2 100644 --- a/CouchLog/Components/Account/Shared/ManageNavMenu.razor +++ b/CouchLog/Components/Account/Shared/ManageNavMenu.razor @@ -3,33 +3,41 @@ @inject SignInManager SignInManager - + + @code { private bool hasExternalLogins; diff --git a/CouchLog/Components/AdminSettings/Pages/CouchLogSettings.razor b/CouchLog/Components/AdminSettings/Pages/CouchLogSettings.razor index 4fb8717..d7e35bd 100644 --- a/CouchLog/Components/AdminSettings/Pages/CouchLogSettings.razor +++ b/CouchLog/Components/AdminSettings/Pages/CouchLogSettings.razor @@ -17,11 +17,11 @@ Color="Color.Primary" /> -Version: @_version +@*Version: @_version*@ @code { - private AccountsSettings? _accountsSettings; - private readonly string _version = Assembly.GetEntryAssembly().GetCustomAttribute()?.InformationalVersion?.Split('+')[0]; + private AccountsSettings _accountsSettings = null!; + //private readonly string _version = Assembly.GetEntryAssembly().GetCustomAttribute()?.InformationalVersion?.Split('+')[0]; protected override async Task OnInitializedAsync() { diff --git a/CouchLog/Components/Pages/GlobalList/Components/GlobalEntityCard.razor b/CouchLog/Components/Pages/GlobalList/Components/GlobalEntityCard.razor index 09d3e19..5ece883 100644 --- a/CouchLog/Components/Pages/GlobalList/Components/GlobalEntityCard.razor +++ b/CouchLog/Components/Pages/GlobalList/Components/GlobalEntityCard.razor @@ -1,11 +1,14 @@ @using CouchLog.Data - + + - @GlobalEntity.Title + + @GlobalEntity.Title + diff --git a/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor b/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor index 57feb7f..6d08b57 100644 --- a/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor +++ b/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor @@ -1,10 +1,9 @@ @using CouchLog.Data @using Microsoft.EntityFrameworkCore -@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Identity @using System.ComponentModel.DataAnnotations -@inject ApplicationDbContext CouchLogDB +@inject ApplicationDbContext CouchLogDb @inject UserManager UserManager @inject AuthenticationStateProvider AuthenticationStateProvider @inject NavigationManager NavigationManager @@ -120,7 +119,7 @@ //Picture private IBrowserFile? _pictureFile; - private string _pictureBase64; + private string _pictureBase64 = null!; private string? _pictureContentType; private string? _pictureExtension; @@ -145,8 +144,8 @@ return; } - _mediaTypes = await CouchLogDB.MediaType.OrderBy(t => t.Id).ToListAsync(); - _genres = await CouchLogDB.Genres.OrderBy(t => t.Id).ToListAsync(); + _mediaTypes = await CouchLogDb.MediaType.OrderBy(t => t.Id).ToListAsync(); + _genres = await CouchLogDb.Genres.OrderBy(t => t.Id).ToListAsync(); if (_mediaTypes.Count > 0) _selectedMediaTypeId = _mediaTypes.First().Id; @@ -212,19 +211,19 @@ IsPrivate = _isPrivate }; - CouchLogDB.Add(entity); - await CouchLogDB.SaveChangesAsync(); + CouchLogDb.Add(entity); + await CouchLogDb.SaveChangesAsync(); foreach (int genreId in _selectedGenreIds) { - CouchLogDB.Add(new LinkTableGlobalGenre + CouchLogDb.Add(new LinkTableGlobalGenre { GenreId = genreId, GlobalEntityId = entity.Id }); } - await CouchLogDB.SaveChangesAsync(); + await CouchLogDb.SaveChangesAsync(); Snackbar.Add("Global Entity created!", Severity.Success); MudDialog.Close(DialogResult.Ok(entity)); diff --git a/CouchLog/Components/Pages/GlobalList/Dialogs/EditGlobalEntityDialog.razor b/CouchLog/Components/Pages/GlobalList/Dialogs/EditGlobalEntityDialog.razor new file mode 100644 index 0000000..5973a9b --- /dev/null +++ b/CouchLog/Components/Pages/GlobalList/Dialogs/EditGlobalEntityDialog.razor @@ -0,0 +1,28 @@ +@using CouchLog.Data + + + + Edit Global Entity + + + + + + + + Cancel + + + +@code +{ + [CascadingParameter] private IMudDialogInstance Dialog { get; set; } = null!; + + [Parameter] public GlobalEntity GlobalEntity { get; set; } = null!; + + private void Cancel() + { + Dialog.Cancel(); + } +} +S \ No newline at end of file diff --git a/CouchLog/Components/Pages/GlobalList/GlobalList.razor b/CouchLog/Components/Pages/GlobalList/GlobalList.razor index c1d54d4..2cc914b 100644 --- a/CouchLog/Components/Pages/GlobalList/GlobalList.razor +++ b/CouchLog/Components/Pages/GlobalList/GlobalList.razor @@ -78,7 +78,7 @@ @foreach (var globalEntity in VisibleGlobalEntities) { - + FiltertGlobalEntities => _privateEntities.Where(entity => (string.IsNullOrWhiteSpace(_searchString) || entity.GlobalEntity.Title.Contains(_searchString, StringComparison.OrdinalIgnoreCase)) //Search bar ); diff --git a/CouchLog/CouchLog.csproj b/CouchLog/CouchLog.csproj index 915973e..bcff7d6 100644 --- a/CouchLog/CouchLog.csproj +++ b/CouchLog/CouchLog.csproj @@ -9,6 +9,8 @@ True 0.1.0-nightly.10 Penry + false + false @@ -60,26 +62,23 @@ - - - - - - - - - - + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/CouchLog/Data/DatabaseModels/Global/GlobalEntity.cs b/CouchLog/Data/DatabaseModels/Global/GlobalEntity.cs index 0abf9d8..cb3cc21 100644 --- a/CouchLog/Data/DatabaseModels/Global/GlobalEntity.cs +++ b/CouchLog/Data/DatabaseModels/Global/GlobalEntity.cs @@ -4,8 +4,7 @@ using System.Diagnostics.CodeAnalysis; namespace CouchLog.Data { - [method: SetsRequiredMembers] - public class GlobalEntity() + public class GlobalEntity { [Key] public int Id { get; set; }