pwbox change and changepw @ first login change
This commit is contained in:
parent
549ab3e53b
commit
3f30ebfde2
3
.idea/.idea.ChronoFlow/.idea/avalonia.xml
generated
3
.idea/.idea.ChronoFlow/.idea/avalonia.xml
generated
@ -5,7 +5,9 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry key="ChronoFlow.View/Admin/AdminMainView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/Admin/AdminMainView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/Admin/ConfirmDialog.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/Admin/ConfirmDialog.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
|
<entry key="ChronoFlow.View/Admin/MitarbeiterBearbeitenDialog.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/Admin/MitarbeiterListeView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/Admin/MitarbeiterListeView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
|
<entry key="ChronoFlow.View/Admin/ProjektBearbeitenDialog.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/Admin/ProjektErstellenView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/Admin/ProjektErstellenView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/App.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/App.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/LoginView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/LoginView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
@ -16,6 +18,7 @@
|
|||||||
<entry key="ChronoFlow.View/Mitarbeiter/MitarbeiterMainView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/Mitarbeiter/MitarbeiterMainView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/Mitarbeiter/MitarbeiterView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/Mitarbeiter/MitarbeiterView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/MitarbeiterHinzufuegenView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/MitarbeiterHinzufuegenView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
|
<entry key="ChronoFlow.View/Security/PasswortAendernDialog.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
<entry key="ChronoFlow.View/ZeiterfassungView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
<entry key="ChronoFlow.View/ZeiterfassungView.axaml" value="ChronoFlow.View/ChronoFlow.View.csproj" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@ -3,23 +3,34 @@
|
|||||||
x:Class="ChronoFlow.View.Admin.MitarbeiterBearbeitenDialog"
|
x:Class="ChronoFlow.View.Admin.MitarbeiterBearbeitenDialog"
|
||||||
Width="450" Height="600"
|
Width="450" Height="600"
|
||||||
Title="Mitarbeiter bearbeiten">
|
Title="Mitarbeiter bearbeiten">
|
||||||
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<StackPanel Margin="20" Spacing="15">
|
<StackPanel Margin="20" Spacing="15">
|
||||||
|
|
||||||
|
<!-- Eingabe: Username -->
|
||||||
<TextBlock Text="Username:" />
|
<TextBlock Text="Username:" />
|
||||||
<TextBox x:Name="UsernameBox" />
|
<TextBox x:Name="UsernameBox" />
|
||||||
|
|
||||||
|
<!-- Eingabe: Abteilung -->
|
||||||
<TextBlock Text="Abteilung:" />
|
<TextBlock Text="Abteilung:" />
|
||||||
<TextBox x:Name="AbteilungBox" />
|
<TextBox x:Name="AbteilungBox" />
|
||||||
|
|
||||||
|
<!-- Eingabe: Mitarbeiternummer -->
|
||||||
<TextBlock Text="Mitarbeiternummer:" />
|
<TextBlock Text="Mitarbeiternummer:" />
|
||||||
<TextBox x:Name="MitarbeiternummerBox" />
|
<TextBox x:Name="MitarbeiternummerBox" />
|
||||||
|
|
||||||
|
<!-- Checkbox für Passwort-Reset -->
|
||||||
|
<TextBlock Text="Passwort zurücksetzen:" />
|
||||||
|
<CheckBox x:Name="ResetPasswordCheckbox"
|
||||||
|
Content="Passwort auf 'newpassword' zurücksetzen und beim nächsten Login ändern lassen" />
|
||||||
|
|
||||||
|
<!-- Buttons: Speichern & Abbrechen -->
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10" Margin="0,10,0,0">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="10" Margin="0,10,0,0">
|
||||||
<Button Content="✅ Speichern" Width="120" Click="SpeichernButton_Click" />
|
<Button Content="✅ Speichern" Width="120" Click="SpeichernButton_Click" />
|
||||||
<Button Content="❌ Abbrechen" Width="120" Click="AbbrechenButton_Click" />
|
<Button Content="❌ Abbrechen" Width="120" Click="AbbrechenButton_Click" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Erfolgs-Hinweis -->
|
<!-- Hinweistext bei Erfolg -->
|
||||||
<TextBlock x:Name="FeedbackText"
|
<TextBlock x:Name="FeedbackText"
|
||||||
Text="Änderungen erfolgreich übernommen."
|
Text="Änderungen erfolgreich übernommen."
|
||||||
Foreground="Green"
|
Foreground="Green"
|
||||||
|
|||||||
@ -1,39 +1,69 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using ChronoFlow.Model;
|
using ChronoFlow.Model;
|
||||||
|
using ChronoFlow.Security;
|
||||||
|
|
||||||
namespace ChronoFlow.View.Admin;
|
namespace ChronoFlow.View.Admin;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dialogfenster zur Bearbeitung eines Mitarbeiters durch den Admin.
|
||||||
|
/// Enthält Eingabefelder für Name, Abteilung, Nummer und optional Passwort-Reset.
|
||||||
|
/// </summary>
|
||||||
public partial class MitarbeiterBearbeitenDialog : Window
|
public partial class MitarbeiterBearbeitenDialog : Window
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Benutzerobjekt mit den aktualisierten Werten, wird beim Schließen zurückgegeben.
|
||||||
|
/// </summary>
|
||||||
public User UpdatedUser { get; private set; }
|
public User UpdatedUser { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Konstruktor – befüllt die UI mit den bestehenden Benutzerwerten.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">Der zu bearbeitende Benutzer</param>
|
||||||
public MitarbeiterBearbeitenDialog(User user)
|
public MitarbeiterBearbeitenDialog(User user)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Erzeuge eine Kopie mit übertragbaren Werten
|
||||||
UpdatedUser = new User
|
UpdatedUser = new User
|
||||||
{
|
{
|
||||||
Username = user.Username,
|
Username = user.Username,
|
||||||
OriginalUsername = user.Username, // Speichern des alten Namens
|
OriginalUsername = user.Username, // für Identifikation bei Änderungen
|
||||||
Abteilung = user.Abteilung,
|
Abteilung = user.Abteilung,
|
||||||
Mitarbeiternummer = user.Mitarbeiternummer
|
Mitarbeiternummer = user.Mitarbeiternummer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Setze UI-Felder
|
||||||
UsernameBox.Text = user.Username;
|
UsernameBox.Text = user.Username;
|
||||||
AbteilungBox.Text = user.Abteilung;
|
AbteilungBox.Text = user.Abteilung;
|
||||||
MitarbeiternummerBox.Text = user.Mitarbeiternummer;
|
MitarbeiternummerBox.Text = user.Mitarbeiternummer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wird ausgeführt, wenn der Admin auf „Speichern“ klickt.
|
||||||
|
/// Änderungen werden übernommen und ggf. Passwort zurückgesetzt.
|
||||||
|
/// </summary>
|
||||||
private void SpeichernButton_Click(object? sender, RoutedEventArgs e)
|
private void SpeichernButton_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
// Aktualisiere Werte aus der Eingabe
|
||||||
UpdatedUser.Username = UsernameBox.Text ?? UpdatedUser.Username;
|
UpdatedUser.Username = UsernameBox.Text ?? UpdatedUser.Username;
|
||||||
UpdatedUser.Abteilung = AbteilungBox.Text ?? UpdatedUser.Abteilung;
|
UpdatedUser.Abteilung = AbteilungBox.Text ?? UpdatedUser.Abteilung;
|
||||||
UpdatedUser.Mitarbeiternummer = MitarbeiternummerBox.Text ?? UpdatedUser.Mitarbeiternummer;
|
UpdatedUser.Mitarbeiternummer = MitarbeiternummerBox.Text ?? UpdatedUser.Mitarbeiternummer;
|
||||||
|
|
||||||
|
// Falls Passwort zurückgesetzt werden soll
|
||||||
|
if (ResetPasswordCheckbox.IsChecked == true)
|
||||||
|
{
|
||||||
|
UpdatedUser.Password = PasswordHasher.HashPassword("newpassword");
|
||||||
|
UpdatedUser.MussPasswortAendern = true; // Benutzer muss neues Passwort setzen
|
||||||
|
}
|
||||||
|
|
||||||
|
// Schließe Fenster und übergebe aktualisierten Benutzer
|
||||||
this.Close(UpdatedUser);
|
this.Close(UpdatedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wird ausgeführt, wenn der Admin den Dialog ohne Änderungen verlässt.
|
||||||
|
/// </summary>
|
||||||
private void AbbrechenButton_Click(object? sender, RoutedEventArgs e)
|
private void AbbrechenButton_Click(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close(null);
|
this.Close(null);
|
||||||
|
|||||||
@ -8,11 +8,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="11.0.6" />
|
<PackageReference Include="Avalonia" Version="11.3.1" />
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.6" />
|
<PackageReference Include="Avalonia.Desktop" Version="11.3.1" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="MessageBox.Avalonia" Version="0.10.4" />
|
<PackageReference Include="MessageBox.Avalonia" Version="1.0.1" />
|
||||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.6" />
|
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.1" />
|
||||||
<PackageReference Include="ReactiveUI" Version="20.3.1" />
|
<PackageReference Include="ReactiveUI" Version="20.3.1" />
|
||||||
<PackageReference Include="System.Reactive" Version="6.0.1" />
|
<PackageReference Include="System.Reactive" Version="6.0.1" />
|
||||||
<PackageReference Include="WCKY.Avalonia.AnimationLibrary" Version="1.0.0" />
|
<PackageReference Include="WCKY.Avalonia.AnimationLibrary" Version="1.0.0" />
|
||||||
|
|||||||
@ -8,10 +8,10 @@
|
|||||||
<TextBlock x:Name="UsernameTextBlock" Text="Benutzer: " FontSize="16" FontWeight="Bold" />
|
<TextBlock x:Name="UsernameTextBlock" Text="Benutzer: " FontSize="16" FontWeight="Bold" />
|
||||||
|
|
||||||
<TextBlock Text="Neues Passwort:" />
|
<TextBlock Text="Neues Passwort:" />
|
||||||
<TextBox x:Name="NeuesPasswortBox" />
|
<TextBox x:Name="NeuesPasswortBox" PasswordChar="●" />
|
||||||
|
|
||||||
<TextBlock Text="Passwort bestätigen:" />
|
<TextBlock Text="Passwort bestätigen:" />
|
||||||
<TextBox x:Name="BestaetigenBox" />
|
<TextBox x:Name="BestaetigenBox" PasswordChar="●" />
|
||||||
|
|
||||||
<TextBlock x:Name="FehlerText" Foreground="Red" IsVisible="False" />
|
<TextBlock x:Name="FehlerText" Foreground="Red" IsVisible="False" />
|
||||||
|
|
||||||
|
|||||||
@ -9,11 +9,11 @@ public partial class PasswortAendernDialog : Window
|
|||||||
public string NeuesPasswort { get; private set; } = "";
|
public string NeuesPasswort { get; private set; } = "";
|
||||||
private readonly User _user;
|
private readonly User _user;
|
||||||
|
|
||||||
// Konstruktor mit Benutzerobjekt
|
|
||||||
public PasswortAendernDialog(User user)
|
public PasswortAendernDialog(User user)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_user = user;
|
_user = user;
|
||||||
|
UsernameTextBlock.Text = $"Benutzer: {_user.Username}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpeichernButton_Click(object? sender, RoutedEventArgs e)
|
private void SpeichernButton_Click(object? sender, RoutedEventArgs e)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user