owner = user, working now

This commit is contained in:
taarly 2025-06-29 18:30:44 +02:00
parent cceb2cc7ee
commit 7ef66a0b3d
3 changed files with 14 additions and 1 deletions

View File

@ -16,7 +16,7 @@ public partial class AppController
public static void NewEntrySave(string name, string usernameurl, string email, string password, string note)
{
string hashedPassword = ShaHash.HashPassword(password);
string ownerUsername = "user";
string ownerUsername = _currentUser;
SQLite.SaveEntry(name, hashedPassword, email, note, ownerUsername);
//string name, string pass, string mailUsername, string? note, string ownerUsername
}
@ -29,4 +29,14 @@ public partial class AppController
var savedPassword = SQLite.GetLogin(Username);
return hashedPassword == savedPassword;
}
//the currently logged in user
private static string _currentUser;
public static void SetCurrentUser(string currentUser)
{
_currentUser = currentUser;
}
}

View File

@ -29,6 +29,7 @@ public partial class LoginPage : UserControl
if (allowLogin)
{
//show menuview
AppController.SetCurrentUser(loginName);
newMenuView.Show();
}
else

View File

@ -14,6 +14,7 @@ public partial class NewLogin : Window
public NewLogin()
{
InitializeComponent();
_controller = new();
}
public NewLogin(AppController controller)
@ -31,6 +32,7 @@ public partial class NewLogin : Window
bool masterLoginPasswordBool = InputSanitizer.MasterLoginPasswordBool(password);
bool masterLoginEmailBool = InputSanitizer.MasterLoginEmailBool(email);
bool masterLoginNameBool = InputSanitizer.MasterLoginNameBool(username);
//give strings to appcontroller and keep working on them there
if (masterLoginPasswordBool && masterLoginEmailBool && masterLoginNameBool)
{