mirror of
https://github.com/claunia/marechai.git
synced 2026-07-08 17:57:08 +00:00
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.
This commit is contained in:
@@ -45,14 +45,6 @@ public partial class LoginViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _recoveryCode = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// <see langword="true" /> 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.
|
||||
/// </summary>
|
||||
[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<string, string>
|
||||
{
|
||||
["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))
|
||||
|
||||
@@ -256,8 +256,7 @@
|
||||
<HyperlinkButton
|
||||
Content="{Binding Source={StaticResource Strings}, Path=LoginPage_ResendConfirmationLink}"
|
||||
Command="{Binding ResendConfirmationCommand}"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding EmailNotConfirmed, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user