Profil: Logout after password change

This commit is contained in:
Andre Beging
2022-05-30 11:17:47 +02:00
parent 607fab1d04
commit e9f0bcc993
3 changed files with 19 additions and 4 deletions

View File

@@ -48,6 +48,11 @@ namespace FoodsharingSiegen.Server.BaseClasses
/// </summary> /// </summary>
[Inject] protected IMessageService? Message { get; set; } [Inject] protected IMessageService? Message { get; set; }
/// <summary>
/// Gets or sets the value of the navigation manager (ab)
/// </summary>
[Inject] protected NavigationManager? NavigationManager { get; set; }
#endregion #endregion
/// <summary> /// <summary>

View File

@@ -33,9 +33,17 @@
</Validations> </Validations>
</Fields> </Fields>
<hr />
<h3>Sicherheit</h3> <h3>Sicherheit</h3>
<Button Color="Color.Primary" Class="mb-2" Clicked="() => PasswordModal?.Show(User)!">Passwort ändern</Button> <p class="mt-4 mb-1">
<Button Color="Color.Danger" Class="mb-2" Clicked="RemoveAccount">Konto löschen</Button> Die Änderung deines Passworts ist sofort aktiv. Im Anschluss wirst du ausgeloggt und kannst dich neu einloggen.
<Button Color="Color.Primary" Class="d-block" Clicked="() => PasswordModal?.Show(User)!"><i class="fa-solid fa-key"></i>&nbsp;Passwort ändern</Button>
</p>
<p class="mt-4 mb-1">
Dein Konto zu löschen ist endgültig und kann nicht rückgängig gemacht werden.
<Button Color="Color.Danger" Class="d-block" Clicked="RemoveAccount"><i class="fa-solid fa-trash"></i>&nbsp;Konto löschen</Button>
</p>
</div> </div>
<SetPasswordModal @ref="PasswordModal" OnPasswortSet="OnPasswordSet"></SetPasswordModal> <SetPasswordModal @ref="PasswordModal" OnPasswortSet="OnPasswordSet"></SetPasswordModal>

View File

@@ -93,7 +93,9 @@ namespace FoodsharingSiegen.Server.Pages
{ {
var setPasswordR = await UserService?.SetPassword(arg)!; var setPasswordR = await UserService?.SetPassword(arg)!;
if (setPasswordR.Success) if (setPasswordR.Success)
await Notification?.Success("Dein neues Passwort wurde gespeichert")!; NavigationManager?.NavigateTo("/logout");
else
await Notification?.Success(setPasswordR.ErrorMessage)!;
} }
#endregion #endregion