From 74ec397617cb99a1bf17e5183d004ad50d772814 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 4 Jul 2026 14:54:42 +0100 Subject: [PATCH] Show resend-confirmation link on any login failure in Uno app The server no longer returns an EmailNotConfirmed flag. Remove the emailNotConfirmed sentinel from AuthService, the EmailNotConfirmed observable property and branch from LoginViewModel, and drop the Visibility binding from the resend button so it is always shown in the login form regardless of the failure reason. --- .../Presentation/ViewModels/LoginViewModel.cs | 23 ------------------- .../Presentation/Views/LoginPage.xaml | 3 +-- .../Services/Authentication/AuthService.cs | 10 -------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/Marechai.App/Presentation/ViewModels/LoginViewModel.cs b/Marechai.App/Presentation/ViewModels/LoginViewModel.cs index a835e393..f2787d4e 100644 --- a/Marechai.App/Presentation/ViewModels/LoginViewModel.cs +++ b/Marechai.App/Presentation/ViewModels/LoginViewModel.cs @@ -45,14 +45,6 @@ public partial class LoginViewModel : ObservableObject [ObservableProperty] private string _recoveryCode = string.Empty; - /// - /// when the last login attempt's password was correct but the account's - /// email address has not yet been confirmed. Surfaces the "Resend confirmation email" link in the - /// UI. - /// - [ObservableProperty] - private bool _emailNotConfirmed; - public bool HasMultipleMethods => AvailableMethods.Count > 1; public bool ShowSendEmailButton => !RecoveryMode && SelectedProvider == "email"; @@ -89,8 +81,6 @@ public partial class LoginViewModel : ObservableObject try { - EmailNotConfirmed = false; - var credentials = new Dictionary { ["Email"] = Email, @@ -107,19 +97,6 @@ public partial class LoginViewModel : ObservableObject return; } - // Did the server signal that email confirmation is required? - if(credentials.TryGetValue("emailNotConfirmed", out string? notConfirmed) && notConfirmed == "true") - { - EmailNotConfirmed = true; - - if(credentials.TryGetValue("error", out string? unconfirmedError)) - ErrorMessage = unconfirmedError; - else - ErrorMessage = _stringLocalizer["LoginPage.Error.EmailNotConfirmed"]; - - return; - } - // Did the server signal that a 2FA step is required? if(credentials.TryGetValue("requiresTwoFactor", out string? flag) && flag == "true" && credentials.TryGetValue("twoFactorToken", out string? token)) diff --git a/Marechai.App/Presentation/Views/LoginPage.xaml b/Marechai.App/Presentation/Views/LoginPage.xaml index 5805ef41..c9266675 100644 --- a/Marechai.App/Presentation/Views/LoginPage.xaml +++ b/Marechai.App/Presentation/Views/LoginPage.xaml @@ -256,8 +256,7 @@ + HorizontalAlignment="Center" /> diff --git a/Marechai.App/Services/Authentication/AuthService.cs b/Marechai.App/Services/Authentication/AuthService.cs index 0273f78a..551a2a81 100644 --- a/Marechai.App/Services/Authentication/AuthService.cs +++ b/Marechai.App/Services/Authentication/AuthService.cs @@ -89,16 +89,6 @@ public sealed class AuthService if(string.IsNullOrWhiteSpace(authResponse?.Token)) { - // Email not yet confirmed: bubble up so the LoginViewModel can show a "resend confirmation" - // affordance. Same sentinel-key transport convention as the two-factor signal below. - if(authResponse?.EmailNotConfirmed == true) - { - credentials["emailNotConfirmed"] = "true"; - credentials["error"] = stringLocalizer["LoginPage.Error.EmailNotConfirmed"]; - - return false; - } - // Two-factor required: bubble up the pending token + available methods so the LoginViewModel can // swap to the 2FA prompt. We deliberately return false (the ITokenService still has no usable token) // and use sentinel keys in the credentials dictionary as the only available transport.