46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using ChronoFlow.Model;
|
|
|
|
namespace ChronoFlow.View.Security;
|
|
|
|
public partial class PasswortAendernDialog : Window
|
|
{
|
|
public string NeuesPasswort { get; private set; } = "";
|
|
private readonly User _user;
|
|
|
|
// Konstruktor mit Benutzerobjekt
|
|
public PasswortAendernDialog(User user)
|
|
{
|
|
InitializeComponent();
|
|
_user = user;
|
|
}
|
|
|
|
private void SpeichernButton_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
var passwort = NeuesPasswortBox.Text?.Trim();
|
|
var bestaetigen = BestaetigenBox.Text?.Trim();
|
|
|
|
if (string.IsNullOrWhiteSpace(passwort) || string.IsNullOrWhiteSpace(bestaetigen))
|
|
{
|
|
FehlerText.Text = "Bitte alle Felder ausfüllen.";
|
|
FehlerText.IsVisible = true;
|
|
return;
|
|
}
|
|
|
|
if (passwort != bestaetigen)
|
|
{
|
|
FehlerText.Text = "Passwörter stimmen nicht überein.";
|
|
FehlerText.IsVisible = true;
|
|
return;
|
|
}
|
|
|
|
NeuesPasswort = passwort;
|
|
Close(NeuesPasswort);
|
|
}
|
|
|
|
private void AbbrechenButton_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
Close(null);
|
|
}
|
|
} |