Profil: Logout after password change
This commit is contained in:
@@ -47,6 +47,11 @@ namespace FoodsharingSiegen.Server.BaseClasses
|
||||
/// Gets or sets the value of the message (ab)
|
||||
/// </summary>
|
||||
[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
|
||||
|
||||
|
||||
@@ -33,9 +33,17 @@
|
||||
</Validations>
|
||||
</Fields>
|
||||
|
||||
<hr />
|
||||
|
||||
<h3>Sicherheit</h3>
|
||||
<Button Color="Color.Primary" Class="mb-2" Clicked="() => PasswordModal?.Show(User)!">Passwort ändern</Button>
|
||||
<Button Color="Color.Danger" Class="mb-2" Clicked="RemoveAccount">Konto löschen</Button>
|
||||
<p class="mt-4 mb-1">
|
||||
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> 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> Konto löschen</Button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<SetPasswordModal @ref="PasswordModal" OnPasswortSet="OnPasswordSet"></SetPasswordModal>
|
||||
@@ -92,8 +92,10 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
private async Task OnPasswordSet(User arg)
|
||||
{
|
||||
var setPasswordR = await UserService?.SetPassword(arg)!;
|
||||
if(setPasswordR.Success)
|
||||
await Notification?.Success("Dein neues Passwort wurde gespeichert")!;
|
||||
if (setPasswordR.Success)
|
||||
NavigationManager?.NavigateTo("/logout");
|
||||
else
|
||||
await Notification?.Success(setPasswordR.ErrorMessage)!;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user