fix prev commit
This commit is contained in:
@@ -42,7 +42,7 @@ namespace OwnChar.Manager
|
|||||||
ArgumentException.ThrowIfNullOrWhiteSpace(username, nameof(username));
|
ArgumentException.ThrowIfNullOrWhiteSpace(username, nameof(username));
|
||||||
ArgumentException.ThrowIfNullOrWhiteSpace(password, nameof(password));
|
ArgumentException.ThrowIfNullOrWhiteSpace(password, nameof(password));
|
||||||
|
|
||||||
CurrentUser = proxy.Login(username, password);
|
CurrentUser = proxy.Login(username, Utils.HashPassword(username, password));
|
||||||
|
|
||||||
return IsLoggedIn;
|
return IsLoggedIn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using OwnChar.Model;
|
using OwnChar.Model;
|
||||||
|
using Pilz.Cryptography;
|
||||||
|
|
||||||
namespace OwnChar.Manager
|
namespace OwnChar.Manager
|
||||||
{
|
{
|
||||||
@@ -12,11 +13,11 @@ namespace OwnChar.Manager
|
|||||||
return Manager.DataProxy!.GetUserProfile(Manager.CurrentUser!);
|
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(username, nameof(username));
|
||||||
ArgumentException.ThrowIfNullOrWhiteSpace(password, nameof(password));
|
ArgumentException.ThrowIfNullOrWhiteSpace(password, nameof(password));
|
||||||
return Manager.DataProxy?.CreateUserAccount(username, password);
|
return Manager.DataProxy?.CreateUserAccount(username, Utils.HashPassword(username, password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
namespace OwnChar
|
using Pilz.Cryptography;
|
||||||
|
|
||||||
|
namespace OwnChar
|
||||||
{
|
{
|
||||||
public static class Utils
|
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!
|
// TODO: Implement a good hasing algorythmus (like MD5) BEFORE going productive!
|
||||||
return (username + ":" + password).GetHashCode().ToString();
|
return (username + ":" + password).GetHashCode().ToString();
|
||||||
|
|||||||
Reference in New Issue
Block a user