diff --git a/AppShell.xaml b/AppShell.xaml index 8b97a0d..edeea18 100644 --- a/AppShell.xaml +++ b/AppShell.xaml @@ -12,6 +12,11 @@ + + (); + builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/Models/User.cs b/Models/User.cs new file mode 100644 index 0000000..1cf7ac9 --- /dev/null +++ b/Models/User.cs @@ -0,0 +1,58 @@ +using SQLite; +using System.ComponentModel; + +namespace UndacApp.Models +{ + public class User : AModel + { + private string _name; + public string Name + { + get => _name; + set => SetField(ref _name, value); + } + + private string _email; + public string Email + { + get => _email; + set => SetField(ref _email, value); + } + + private string _accessLevel; + public string AccessLevel + { + get => _accessLevel; + set => SetField(ref _accessLevel, value); + } + + private bool _employed = true; + public bool Employed + { + get => _employed; + set => SetField(ref _employed, value); + } + + private string _role; + public string Role + { + get => _role; + set => SetField(ref _role, value); + } + + private string _team; + public string Team + { + get => _team; + set => SetField(ref _team, value); + } + + private string _password; + public string Password + { + get => _password; + set => SetField(ref _password, value); + } + } +} + diff --git a/Services/IUsersService.cs b/Services/IUsersService.cs new file mode 100644 index 0000000..4e2a15a --- /dev/null +++ b/Services/IUsersService.cs @@ -0,0 +1,11 @@ +using UndacApp.Models; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace UndacApp.Services +{ + public interface IUsersService : IService + { + // Define additional methods specific to user management if needed + } +} diff --git a/Services/UserService.cs b/Services/UserService.cs new file mode 100644 index 0000000..1853597 --- /dev/null +++ b/Services/UserService.cs @@ -0,0 +1,16 @@ +using UndacApp.Models; +using System.Threading.Tasks; + +namespace UndacApp.Services +{ + public class UsersService : AService, IUsersService + { + public UsersService() : base() + { + // Additional initialization if required + } + + // Implement any additional methods specific to the User entity + // For now, all basic CRUD operations are inherited from AService + } +} diff --git a/Utils/PasswordHasher.cs b/Utils/PasswordHasher.cs new file mode 100644 index 0000000..b5cd4ee --- /dev/null +++ b/Utils/PasswordHasher.cs @@ -0,0 +1,21 @@ +using System; +using System.Security.Cryptography; +using System.Text; + +public static class PasswordHasher +{ + public static string HashPassword(string password) + { + using (var sha256 = SHA256.Create()) + { + var hashedBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(password)); + return Convert.ToBase64String(hashedBytes); + } + } + + public static bool VerifyPassword(string enteredPassword, string storedHash) + { + string enteredHash = HashPassword(enteredPassword); + return enteredHash == storedHash; + } +} diff --git a/Views/UsersPage.xaml b/Views/UsersPage.xaml new file mode 100644 index 0000000..4bb375a --- /dev/null +++ b/Views/UsersPage.xaml @@ -0,0 +1,45 @@ + + + + + + + + +