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); } //the currently logged in user public static string _currentUser; public static void SetCurrentUser(string currentUser) { _currentUser = currentUser; } //save new entry - hashes the password and gives it to persistence public static void NewEntrySave(string name, string mailusername, string url, string password, string note) { string encrptedPassword = Crypto.EncryptPassword(password); string ownerUsername = _currentUser; SQLite.SaveEntry(name, encrptedPassword, mailusername, url, note, ownerUsername); //string name, string pass, string mailUsername, url, string? note, string ownerUsername } //compares the login and checks if the password is correct. public static bool CompareLogin(string username, string password) { string hashedPassword = ShaHash.HashPassword(password); string Username = username; var savedPassword = SQLite.GetLogin(Username); return hashedPassword == savedPassword; } }