fix prev commit

This commit is contained in:
2024-05-28 15:18:47 +02:00
parent 991987bb6d
commit f8d4fda4f6
3 changed files with 8 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ namespace OwnChar.Manager
ArgumentException.ThrowIfNullOrWhiteSpace(username, nameof(username));
ArgumentException.ThrowIfNullOrWhiteSpace(password, nameof(password));
CurrentUser = proxy.Login(username, password);
CurrentUser = proxy.Login(username, Utils.HashPassword(username, password));
return IsLoggedIn;
}

View File

@@ -1,4 +1,5 @@
using OwnChar.Model;
using Pilz.Cryptography;
namespace OwnChar.Manager
{
@@ -12,11 +13,11 @@ namespace OwnChar.Manager
return Manager.DataProxy!.GetUserProfile(Manager.CurrentUser!);
}
public UserAccount? CreateUserAccount(string? username, string? password)
public UserAccount? CreateUserAccount(string? username, SecureString? password)
{
ArgumentException.ThrowIfNullOrWhiteSpace(username, nameof(username));
ArgumentException.ThrowIfNullOrWhiteSpace(password, nameof(password));
return Manager.DataProxy?.CreateUserAccount(username, password);
return Manager.DataProxy?.CreateUserAccount(username, Utils.HashPassword(username, password));
}
}
}

View File

@@ -1,8 +1,10 @@
namespace OwnChar
using Pilz.Cryptography;
namespace OwnChar
{
public static class Utils
{
public static string HashPassword(string username, string password)
public static string HashPassword(string username, SecureString password)
{
// TODO: Implement a good hasing algorythmus (like MD5) BEFORE going productive!
return (username + ":" + password).GetHashCode().ToString();