Project_Keywi/Project.Controller/AppController.cs
2025-05-19 16:24:05 +02:00

23 lines
734 B
C#

using Project.Persistence;
using Project.Model;
namespace Project.Controller;
public partial class AppController
{
//save new login - hashes the password and gives it to persistence
public static void NewLoginSave(string username, string password, string email)
{
string hashedPassword = ShaHash.HashPassword(password);
var user = new NewUser(username, hashedPassword, email);
SQLite.SaveUser(user);
}
public static bool CompareLogin(string username, string password)
{
string hashedPassword = ShaHash.HashPassword(password);
string Username = username;
var savedPassword = SQLite.GetLogin(Username);
return hashedPassword == savedPassword;
}
}