diff --git a/src/Yavsc.Api.Test/RdvQueryApiControllerTests.cs b/src/Yavsc.Api.Test/RdvQueryApiControllerTests.cs index 668814239..fcd87f9a3 100644 --- a/src/Yavsc.Api.Test/RdvQueryApiControllerTests.cs +++ b/src/Yavsc.Api.Test/RdvQueryApiControllerTests.cs @@ -112,35 +112,4 @@ public sealed class RdvQueryApiControllerTests : IClassFixture(TestContext.Current.CancellationToken); - Assert.NotNull(created); - Assert.Equal(DateTimeKind.Utc, created!.EventDate.Kind); - } } diff --git a/src/Yavsc.Api/Controllers/Business/RdvQueryApiController.cs b/src/Yavsc.Api/Controllers/Business/RdvQueryApiController.cs index 48e3be2e1..dd2982138 100644 --- a/src/Yavsc.Api/Controllers/Business/RdvQueryApiController.cs +++ b/src/Yavsc.Api/Controllers/Business/RdvQueryApiController.cs @@ -67,7 +67,6 @@ public class RdvQueryApiController : Controller var uid = User.GetUserId(); // Security: the caller always posts for themselves. query.ClientId = uid; - query.EventDate = EnsureUtc(query.EventDate); ModelState.Remove("Client"); ModelState.Remove("ClientId"); @@ -141,7 +140,7 @@ public class RdvQueryApiController : Controller existing.ActivityCode = query.ActivityCode; existing.PerformerId = query.PerformerId; existing.Consent = query.Consent; - existing.EventDate = EnsureUtc(query.EventDate); + existing.EventDate = query.EventDate; existing.LocationType = query.LocationType; existing.Reason = query.Reason; existing.Status = query.Status; @@ -207,14 +206,4 @@ public class RdvQueryApiController : Controller { return _context.RdvQueries.Any(e => e.Id == id); } - - private static DateTime EnsureUtc(DateTime value) - { - return value.Kind switch - { - DateTimeKind.Utc => value, - DateTimeKind.Local => value.ToUniversalTime(), - _ => DateTime.SpecifyKind(value, DateTimeKind.Utc) - }; - } } diff --git a/src/Yavsc.Org/Controllers/Accounting/AccountController.cs b/src/Yavsc.Org/Controllers/Accounting/AccountController.cs index 44927d461..77e0e32a4 100644 --- a/src/Yavsc.Org/Controllers/Accounting/AccountController.cs +++ b/src/Yavsc.Org/Controllers/Accounting/AccountController.cs @@ -467,25 +467,8 @@ IHtmlLocalizerFactory htmlLocalizerFactory, if (ModelState.IsValid) { - var existingUser = await _userManager.FindByEmailAsync(model.Email); - if (existingUser is not null) - { - ModelState.AddModelError(nameof(model.Email), _localizer["DuplicateEmail"]); - return View(model); - } - var user = new ApplicationUser { UserName = model.UserName, Email = model.Email }; - IdentityResult result; - try - { - result = await _userManager.CreateAsync(user, model.Password); - } - catch (DbUpdateException ex) when (IsDuplicateEmailViolation(ex)) - { - _logger.LogWarning(ex, "Registration rejected: duplicate email '{Email}'.", model.Email); - ModelState.AddModelError(nameof(model.Email), _localizer["DuplicateEmail"]); - return View(model); - } + var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation(3, "User created a new account with password."); @@ -534,21 +517,6 @@ IHtmlLocalizerFactory htmlLocalizerFactory, return View(model); } - private static bool IsDuplicateEmailViolation(Exception exception) - { - for (var current = exception; current is not null; current = current.InnerException) - { - if (current is PostgresException pg - && pg.SqlState == PostgresErrorCodes.UniqueViolation - && string.Equals(pg.ConstraintName, "AK_AspNetUsers_Email", StringComparison.Ordinal)) - { - return true; - } - } - - return false; - } - [Authorize, HttpPost, ValidateAntiForgeryToken] public async Task SendConfirationEmail() {