From 65173cea1c7f0918466854535276001cfe2ffb15 Mon Sep 17 00:00:00 2001 From: "jozsef.b@aycode.com" <9Rj@D}fVwBaN> Date: Mon, 22 Apr 2024 17:30:14 +0200 Subject: [PATCH] Login, Register; improvements, fixes, etc... --- TIAM.Core/Consts/TiamConst.cs | 14 ++++++ TIAM.Database.Test/AdminDalTest.cs | 3 +- TIAM.Database.Test/TIAM.Database.Test.csproj | 31 ++++++++++--- TIAM.Database.Test/UserDalTests.cs | 39 +++++++++++++++- .../appsettings.Development.json | 17 +++++++ TIAM.Database.Test/appsettings.json | 22 +++++++++ TIAM.Database/DataLayers/Admins/AdminDal.cs | 30 ++++++------ TIAM.Database/TIAM.Database.csproj | 6 +-- TIAM.Entities/TIAM.Entities.csproj | 2 +- TIAMMobileApp/TIAMMobileApp.csproj | 10 ++-- .../Pages/Components/InputWizard.razor.cs | 5 +- TIAMSharedUI/Pages/Components/Step1.razor | 3 +- TIAMSharedUI/Pages/Components/Step2.razor | 3 +- TIAMSharedUI/Pages/DbTestComponent.razor | 3 +- TIAMSharedUI/TIAMSharedUI.csproj | 7 ++- TIAMWebApp/Client/TIAMWebApp.Client.csproj | 8 ++-- .../Controllers/GoogleAPIController .cs | 2 +- .../ServiceProviderAPIController.cs | 2 +- .../Server/Controllers/UserAPIController.cs | 8 ++-- .../Server/Services/Logins/ILoginService.cs | 17 +++++++ .../Server/Services/Logins/LoginService.cs | 46 +++++++++++++++++++ TIAMWebApp/Server/TIAMWebApp.Server.csproj | 20 +++++--- .../TIAMWebApp.Shared.Application.csproj | 8 ++-- .../Shared/Utility/TIAMRegularExpressions.cs | 17 ------- 24 files changed, 247 insertions(+), 76 deletions(-) create mode 100644 TIAM.Core/Consts/TiamConst.cs create mode 100644 TIAM.Database.Test/appsettings.Development.json create mode 100644 TIAM.Database.Test/appsettings.json create mode 100644 TIAMWebApp/Server/Services/Logins/ILoginService.cs create mode 100644 TIAMWebApp/Server/Services/Logins/LoginService.cs delete mode 100644 TIAMWebApp/Shared/Utility/TIAMRegularExpressions.cs diff --git a/TIAM.Core/Consts/TiamConst.cs b/TIAM.Core/Consts/TiamConst.cs new file mode 100644 index 00000000..29b54de5 --- /dev/null +++ b/TIAM.Core/Consts/TiamConst.cs @@ -0,0 +1,14 @@ +using AyCode.Core.Consts; + +namespace TIAM.Core.Consts; + +public class TiamConst : AcConst +{ + public static string ProjectIdString = "684f34d1-163a-4077-918f-a9d9df5ce789"; + + static TiamConst() + { + ProjectId = Guid.Parse(ProjectIdString); + ProjectSalt = GenerateProjectSalt(ProjectId.ToString("N")); + } +} \ No newline at end of file diff --git a/TIAM.Database.Test/AdminDalTest.cs b/TIAM.Database.Test/AdminDalTest.cs index 2bfdee32..b11a561c 100644 --- a/TIAM.Database.Test/AdminDalTest.cs +++ b/TIAM.Database.Test/AdminDalTest.cs @@ -14,6 +14,7 @@ using TIAM.Entities.Users; using TIAM.Models.Dtos.Users; using TIAM.Entities.Transfers; using TIAM.Entities.Profiles; +using AyCode.Core.Extensions; namespace TIAM.Database.Test { @@ -604,7 +605,7 @@ namespace TIAM.Database.Test user.Profile = profile; user.Profile.Address = address; - Assert.IsTrue(await Dal.AddUser(user)); + Assert.IsTrue(await Dal.AddUserAsync(user)); user = Dal.GetUserById(userId); Assert.IsNotNull(user); diff --git a/TIAM.Database.Test/TIAM.Database.Test.csproj b/TIAM.Database.Test/TIAM.Database.Test.csproj index 080f34d3..e871fda1 100644 --- a/TIAM.Database.Test/TIAM.Database.Test.csproj +++ b/TIAM.Database.Test/TIAM.Database.Test.csproj @@ -10,14 +10,32 @@ - - - - + + + + + + + PreserveNewest + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + + + + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -29,6 +47,7 @@ + diff --git a/TIAM.Database.Test/UserDalTests.cs b/TIAM.Database.Test/UserDalTests.cs index c0eb5287..1004c913 100644 --- a/TIAM.Database.Test/UserDalTests.cs +++ b/TIAM.Database.Test/UserDalTests.cs @@ -14,19 +14,33 @@ using TIAM.Entities.Profiles; using TIAM.Entities.Users; using TIAM.Models.Dtos.Users; using AyCode.Interfaces.Users.Dtos; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using Microsoft.Extensions.Configuration; +using TIAM.Core.Consts; using TIAM.Entities.ServiceProviders; using TIAM.Entities.Addresses; +using TIAMWebApp.Server.Services.Logins; +//using static Microsoft.ApplicationInsights.MetricDimensionNames.TelemetryContext; namespace TIAM.Database.Test { [TestClass] public class UserDalTests : AcUserDalTestBase { - private Mock _mockContext; + private WebAssemblyHostConfiguration _configuration = new WebAssemblyHostConfiguration(); + //private Mock _mockContext; [TestInitialize] public void TestInitialize() { + _configuration = new WebAssemblyHostConfiguration(); + _configuration.Build(); + _configuration.Reload(); + + //_configuration["JWT:Key"] = "Cee4400-rDMFkVvHPufyLDSzbfu2grgRhpepos299IhTLOXsljkcpt3yUR4RRjPQ"; + //_configuration["JWT:Audience"] = "http://localhost:5000"; + //_configuration["JWT:Issuer"] = "http://localhost:5000"; + //var options = new DbContextOptionsBuilder() // .UseInMemoryDatabase(databaseName: "UserDatabase") // .Options; @@ -39,6 +53,29 @@ namespace TIAM.Database.Test //_userDal = new UserDal(_mockContext.Object); } + //[TestMethod] + public async Task RegisterUser_ReturnsUser_WhenUserExist() + { + //var a = TiamConst.ProjectIdString; + + var userId = Guid.Parse("1ded6045-1278-4b92-a10a-3eb9426e41a3"); + //await Dal.RemoveUserAsync(userId); //kitöröljük a szemetet, ha korábbról bentmaradt - J. + + var loginService = new LoginService(Dal, new WebAssemblyHostConfiguration()); + var user = await loginService.RegistrationAsync(userId, "asdfsdf@ggggg.hu", "alad'r", null); + Assert.IsNotNull(user); + } + + [TestMethod] + public void LoginUser_ReturnsUser_WhenUserExist() + { + //var a = TiamConst.ProjectIdString; + + var loginService = new LoginService(Dal, _configuration); + var user = loginService.Login("asdfsdf@ggggg.hu", "alad'r", out _); + Assert.IsNotNull(user); + } + [TestMethod] [DataRow("540271F6-C604-4C16-8160-D5A7CAFEDF00")] public void GetUserById_ReturnsUser_WhenUserAndRelationsExists(string userIdString) diff --git a/TIAM.Database.Test/appsettings.Development.json b/TIAM.Database.Test/appsettings.Development.json new file mode 100644 index 00000000..23ad61ca --- /dev/null +++ b/TIAM.Database.Test/appsettings.Development.json @@ -0,0 +1,17 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "JWT": { + "Key": "Cee4400-rDMFkVvHPufyLDSzbfu2grgRhpepos299IhTLOXsljkcpt3yUR4RRjPQ", + "Issuer": "https://localhost:7116", + "Audience": "http://localhost:7116" + }, + "SendGrid": { + //"Key": "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" + "Key": "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" + } +} diff --git a/TIAM.Database.Test/appsettings.json b/TIAM.Database.Test/appsettings.json new file mode 100644 index 00000000..48d14a21 --- /dev/null +++ b/TIAM.Database.Test/appsettings.json @@ -0,0 +1,22 @@ +{ + "ConnectionStrings": { + "DeveloperDbConnection": "Data Source=185.51.190.197;Initial Catalog=TIAM_DEV;Trusted_Connection=False;Connect Timeout=200;User ID=Anata_Development_Team;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "JWT": { + "Key": "Cee4400-rDMFkVvHPufyLDSzbfu2grgRhpepos299IhTLOXsljkcpt3yUR4RRjPQ", + "Issuer": "http://localhost:5000", + "Audience": "http://localhost:5000" + }, + "SendGrid": { + //"Key": "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" + "Key": "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" + } + +} diff --git a/TIAM.Database/DataLayers/Admins/AdminDal.cs b/TIAM.Database/DataLayers/Admins/AdminDal.cs index 8de6bc6d..ad8a8b45 100644 --- a/TIAM.Database/DataLayers/Admins/AdminDal.cs +++ b/TIAM.Database/DataLayers/Admins/AdminDal.cs @@ -101,19 +101,21 @@ namespace TIAM.Database.DataLayers.Admins public string? GetUserJsonById(Guid userId) => Session(ctx => ctx.GetUserById(userId)?.ToJson()); public string GetUsersJson() => Session(ctx => ctx.Users.ToJson()); - public Task AddUser(User user) => TransactionAsync(ctx => ctx.AddUser(user)); + public Task AddUserAsync(User user) => TransactionAsync(ctx => ctx.AddUser(user)); - public Task AddUser(User user, string profileName, Address address, string? firstName = null, string? lastName = null) + public Task AddUserAsync(User user, string profileName, Address address, string? firstName = null, string? lastName = null) { return TransactionAsync(ctx => { - var profile = Activator.CreateInstance(); - - profile.Id = Guid.NewGuid(); - profile.Name = profileName; - profile.FirstName = firstName; - profile.LastName = lastName; - profile.Address = address; + var profile = new Profile + { + Id = Guid.NewGuid(), + Name = profileName, + FirstName = firstName, + LastName = lastName, + Address = address, + AddressId = address.Id + }; user.Profile= profile; @@ -129,10 +131,10 @@ namespace TIAM.Database.DataLayers.Admins public string GetProductsJson(bool includeUsers = true) => Session(ctx => ctx.ProductsWithUserRelations(includeUsers).ToJson()); public List GetProductsByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByServiceProviderId(serviceProviderId, includeUsers).ToList()); public string GetProductsJsonByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByServiceProviderId(serviceProviderId, includeUsers).ToJson()); - public Task AddProduct(Product product) => TransactionAsync(ctx => ctx.AddProduct(product)); + public Task AddProductAsync(Product product) => TransactionAsync(ctx => ctx.AddProduct(product)); - public Task UpdateProduct(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product)); - public Task RemoveProduct(Product product) => TransactionAsync(ctx => ctx.RemoveProduct(product)); + public Task UpdateProductAsync(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product)); + public Task RemoveProductAsync(Product product) => TransactionAsync(ctx => ctx.RemoveProduct(product)); public UserProductMapping? GetUserProductMappingById(Guid userProductMappingId, bool autoInclude = true) => Session(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude)); public Task GetUserProductMappingByIdAsync(Guid userProductMappingId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude)); @@ -223,8 +225,8 @@ namespace TIAM.Database.DataLayers.Admins { Context.CreateProduct(product); Console.WriteLine($"Saving product to db {product.Id}, {product.Name}, {product.ServiceProviderId}"); - var _result = Context.SaveChangesAsync(); - return _result.Result > 0; + var result = Context.SaveChangesAsync(); + return result.Result > 0; } public Task> GetServiceProvidersAsync() diff --git a/TIAM.Database/TIAM.Database.csproj b/TIAM.Database/TIAM.Database.csproj index b9bcb4c4..7388da77 100644 --- a/TIAM.Database/TIAM.Database.csproj +++ b/TIAM.Database/TIAM.Database.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/TIAM.Entities/TIAM.Entities.csproj b/TIAM.Entities/TIAM.Entities.csproj index 711e424c..4d3fb02e 100644 --- a/TIAM.Entities/TIAM.Entities.csproj +++ b/TIAM.Entities/TIAM.Entities.csproj @@ -32,7 +32,7 @@ - + diff --git a/TIAMMobileApp/TIAMMobileApp.csproj b/TIAMMobileApp/TIAMMobileApp.csproj index 01bef5c6..81be8f98 100644 --- a/TIAMMobileApp/TIAMMobileApp.csproj +++ b/TIAMMobileApp/TIAMMobileApp.csproj @@ -52,8 +52,8 @@ - - + + @@ -83,15 +83,15 @@ - + - + - + diff --git a/TIAMSharedUI/Pages/Components/InputWizard.razor.cs b/TIAMSharedUI/Pages/Components/InputWizard.razor.cs index 19dd5446..3ded9d9f 100644 --- a/TIAMSharedUI/Pages/Components/InputWizard.razor.cs +++ b/TIAMSharedUI/Pages/Components/InputWizard.razor.cs @@ -17,6 +17,7 @@ using DevExpress.XtraPrinting; using TIAMSharedUI.Shared; using DevExpress.Pdf.Native.BouncyCastle.Asn1.Cms; using System.Text.RegularExpressions; +using AyCode.Core.Consts; namespace TIAMSharedUI.Pages.Components @@ -213,7 +214,7 @@ namespace TIAMSharedUI.Pages.Components editor.OpenComponent>(j++); editor.AddAttribute(j++, "Value", property.GetValue(Data)); - editor.AddAttribute(j++, "Mask", TIAMRegularExpressions.PhoneNumberMask); + editor.AddAttribute(j++, "Mask", AcRegExpression.PhoneNumberMask); editor.AddAttribute(j++, "MaskMode", MaskMode.RegEx); editor.AddAttribute(j++, "BindValueMode", BindValueMode.OnInput); editor.AddAttribute(j++, "NullText", "+11234567890"); @@ -238,7 +239,7 @@ namespace TIAMSharedUI.Pages.Components { editor.OpenComponent>(j++); editor.AddAttribute(j++, "Value", property.GetValue(Data)); - editor.AddAttribute(j++, "Mask", TIAMRegularExpressions.EmailMask); + editor.AddAttribute(j++, "Mask", AcRegExpression.EmailMask); editor.AddAttribute(j++, "MaskMode", MaskMode.RegEx); editor.AddAttribute(j++, "BindValueMode", BindValueMode.OnInput); diff --git a/TIAMSharedUI/Pages/Components/Step1.razor b/TIAMSharedUI/Pages/Components/Step1.razor index f89012db..50512031 100644 --- a/TIAMSharedUI/Pages/Components/Step1.razor +++ b/TIAMSharedUI/Pages/Components/Step1.razor @@ -1,5 +1,6 @@ @using TIAMWebApp.Shared.Application.Models.PageModels; @using TIAMWebApp.Shared.Application.Utility; +@using AyCode.Core.Consts @@ -44,7 +45,7 @@ public EventCallback RegModelChanged { get; set; } //string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}"; - string EmailMask { get; set; } = TIAMRegularExpressions.EmailMask; + string EmailMask { get; set; } = AcRegExpression.EmailMask; MaskAutoCompleteMode AutoCompleteMode { get; set; } = MaskAutoCompleteMode.Strong; char Placeholder { get; set; } = '_'; bool PlaceholderVisible { get; set; } = false; diff --git a/TIAMSharedUI/Pages/Components/Step2.razor b/TIAMSharedUI/Pages/Components/Step2.razor index 3c00aae9..870114a0 100644 --- a/TIAMSharedUI/Pages/Components/Step2.razor +++ b/TIAMSharedUI/Pages/Components/Step2.razor @@ -1,5 +1,6 @@ @using TIAMWebApp.Shared.Application.Models.PageModels; @using TIAMWebApp.Shared.Application.Utility; +@using AyCode.Core.Consts

Step 2: Phone Number

@@ -48,7 +49,7 @@ public EventCallback RegModelChanged { get; set; } //public string PhoneNumberMask { get; set; } = "\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*(\d{1,2})"; - public string PhoneNumberMask { get; set; } = TIAMRegularExpressions.PhoneNumberMask; + public string PhoneNumberMask { get; set; } = AcRegExpression.PhoneNumberMask; char Placeholder = '_'; diff --git a/TIAMSharedUI/Pages/DbTestComponent.razor b/TIAMSharedUI/Pages/DbTestComponent.razor index 440abd62..b2220fc0 100644 --- a/TIAMSharedUI/Pages/DbTestComponent.razor +++ b/TIAMSharedUI/Pages/DbTestComponent.razor @@ -1,4 +1,5 @@ -@using AyCode.Utils.Extensions +@using AyCode.Core.Extensions +@using AyCode.Utils.Extensions @if (Users == null) {

diff --git a/TIAMSharedUI/TIAMSharedUI.csproj b/TIAMSharedUI/TIAMSharedUI.csproj index 8f0f9df9..4e27b8ef 100644 --- a/TIAMSharedUI/TIAMSharedUI.csproj +++ b/TIAMSharedUI/TIAMSharedUI.csproj @@ -15,8 +15,8 @@ - - + + @@ -32,6 +32,9 @@ ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll diff --git a/TIAMWebApp/Client/TIAMWebApp.Client.csproj b/TIAMWebApp/Client/TIAMWebApp.Client.csproj index 48a53d21..2228e98d 100644 --- a/TIAMWebApp/Client/TIAMWebApp.Client.csproj +++ b/TIAMWebApp/Client/TIAMWebApp.Client.csproj @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/TIAMWebApp/Server/Controllers/GoogleAPIController .cs b/TIAMWebApp/Server/Controllers/GoogleAPIController .cs index 32cb0f32..40cb4c9b 100644 --- a/TIAMWebApp/Server/Controllers/GoogleAPIController .cs +++ b/TIAMWebApp/Server/Controllers/GoogleAPIController .cs @@ -156,7 +156,7 @@ namespace TIAMWebApp.Server.Controllers new LocationEx(destination1), new LocationEx(destination2) }, - TravelMode = TravelMode.Driving, + TravelMode = TravelMode.DRIVING, }; response = await GoogleApi.GoogleMaps.DistanceMatrix.QueryAsync(request); diff --git a/TIAMWebApp/Server/Controllers/ServiceProviderAPIController.cs b/TIAMWebApp/Server/Controllers/ServiceProviderAPIController.cs index 3fd352f8..31d68d73 100644 --- a/TIAMWebApp/Server/Controllers/ServiceProviderAPIController.cs +++ b/TIAMWebApp/Server/Controllers/ServiceProviderAPIController.cs @@ -176,7 +176,7 @@ namespace TIAMWebApp.Server.Controllers } else { - var result = _adminDal.AddProduct(product); + var result = _adminDal.AddProductAsync(product); return Ok(result); } } diff --git a/TIAMWebApp/Server/Controllers/UserAPIController.cs b/TIAMWebApp/Server/Controllers/UserAPIController.cs index e62232b9..6ec3d219 100644 --- a/TIAMWebApp/Server/Controllers/UserAPIController.cs +++ b/TIAMWebApp/Server/Controllers/UserAPIController.cs @@ -39,7 +39,7 @@ namespace TIAMWebApp.Server.Controllers private AdminDal _adminDal; private readonly IConfiguration _configuration; private readonly IWebHostEnvironment _webHostEnvironment; - readonly PasswordHasher _hasher = new(); + //readonly PasswordHasher _hasher = new(); /*private UserModel[] users = new UserModel[] @@ -366,7 +366,7 @@ namespace TIAMWebApp.Server.Controllers userToCreate.Profile.Address.AddressText = null; userToCreate.Profile.Address.Latitude = Math.Round(90 + rnd.NextDouble(), 8); userToCreate.Profile.Address.Longitude = Math.Round(180 + rnd.NextDouble(), 8); - result = await _adminDal.AddUser(userToCreate); + result = await _adminDal.AddUserAsync(userToCreate); guestUser = await _userDal.GetUserModelDtoDetailByIdAsync(userId); } } @@ -415,13 +415,13 @@ namespace TIAMWebApp.Server.Controllers private bool VerifyPassword(string password, string hashedPassword) { - var isPasswordValid = _hasher.VerifyPassword(password, hashedPassword); + var isPasswordValid = PasswordHasher.VerifyPassword(password, hashedPassword); return isPasswordValid; } private string HashPassword(string password) { - var hashedPassword = _hasher.HashPassword(password); + var hashedPassword = PasswordHasher.HashPassword(password); return hashedPassword; } } diff --git a/TIAMWebApp/Server/Services/Logins/ILoginService.cs b/TIAMWebApp/Server/Services/Logins/ILoginService.cs new file mode 100644 index 00000000..7b673e1e --- /dev/null +++ b/TIAMWebApp/Server/Services/Logins/ILoginService.cs @@ -0,0 +1,17 @@ +using AyCode.Interfaces.Server.Logins; +using AyCode.Models.Logins; +using AyCode.Models.Server.Logins; +using TIAM.Entities.Addresses; +using TIAM.Entities.Profiles; +using TIAM.Entities.ServiceProviders; +using TIAM.Entities.Users; + +namespace TIAMWebApp.Server.Services.Logins; + +public interface ILoginModel : IAcLoggedInModelBase +{} + +public interface ILoginService : IAcLoginServiceServer +{ + +} \ No newline at end of file diff --git a/TIAMWebApp/Server/Services/Logins/LoginService.cs b/TIAMWebApp/Server/Services/Logins/LoginService.cs new file mode 100644 index 00000000..3e5bd2c5 --- /dev/null +++ b/TIAMWebApp/Server/Services/Logins/LoginService.cs @@ -0,0 +1,46 @@ +using System.Reflection.Metadata.Ecma335; +using System.Security; +using AyCode.Core.Consts; +using AyCode.Interfaces.Server.Logins; +using AyCode.Models.Server.Logins; +using AyCode.Services.Server.Logins; +using AyCode.Utils.Extensions; +using AyCode.Utils.Helpers; +using TIAM.Database.DataLayers.Admins; +using TIAM.Database.DataLayers.Users; +using TIAM.Database.DbContexts.Admins; +using TIAM.Database.DbContexts.Users; +using TIAM.Entities.Addresses; +using TIAM.Entities.Profiles; +using TIAM.Entities.ServiceProviders; +using TIAM.Entities.Users; + +namespace TIAMWebApp.Server.Services.Logins; + +public class LoggedInModel : AcLoggedInModelServer, ILoginModel +{} + +public class LoginService(UserDal userDal, IConfiguration configuration) : AcLoginServiceServer(userDal, configuration), ILoginService + +{ + public override User? Login(string email, string password, out string accessToken) + { + return base.Login(email, password, out accessToken); + } + + public override bool Logout() + { + return base.Logout(); + } + + public override Task RegistrationAsync(string email, string password, string? phoneNumber = null) + { + return base.RegistrationAsync(email, password, phoneNumber); + } + + public override string GenerateDynamicSalt(Guid userId) + { + return base.GenerateDynamicSalt(userId); + } +} + \ No newline at end of file diff --git a/TIAMWebApp/Server/TIAMWebApp.Server.csproj b/TIAMWebApp/Server/TIAMWebApp.Server.csproj index 150fbda5..021e8187 100644 --- a/TIAMWebApp/Server/TIAMWebApp.Server.csproj +++ b/TIAMWebApp/Server/TIAMWebApp.Server.csproj @@ -10,15 +10,15 @@ - - - - + + + + - - - + + + @@ -61,6 +61,12 @@ ..\..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.Server.dll + + ..\..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.dll + + + ..\..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.Server.dll + ..\..\..\AyCode.Core\AyCode.Utils\bin\Debug\net8.0\AyCode.Utils.dll diff --git a/TIAMWebApp/Shared/TIAMWebApp.Shared.Application.csproj b/TIAMWebApp/Shared/TIAMWebApp.Shared.Application.csproj index 878a85be..280b9ba4 100644 --- a/TIAMWebApp/Shared/TIAMWebApp.Shared.Application.csproj +++ b/TIAMWebApp/Shared/TIAMWebApp.Shared.Application.csproj @@ -17,11 +17,11 @@ - + - - - + + + diff --git a/TIAMWebApp/Shared/Utility/TIAMRegularExpressions.cs b/TIAMWebApp/Shared/Utility/TIAMRegularExpressions.cs deleted file mode 100644 index 0fa784e9..00000000 --- a/TIAMWebApp/Shared/Utility/TIAMRegularExpressions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TIAMWebApp.Shared.Application.Utility -{ - public static class TIAMRegularExpressions - { - - public const string EmailMask = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}"; - //public const string EmailMask = @"((\w|[.-])+@(\w|-)+\.(\w|-){2,4})?"; - public const string PhoneNumberMask = "\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*(\\d{1,2})"; - - } -}