Add OtpDialogService for mobile-friendly OTP authentication dialog

This commit is contained in:
masoodafar-web
2025-11-17 02:53:51 +03:30
parent a0c1452a84
commit 52b8298a18
34 changed files with 1495 additions and 279 deletions

View File

@@ -48,7 +48,6 @@ public partial class AuthDialog : IDisposable
[Inject] private ILocalStorageService LocalStorage { get; set; } = default!;
[Inject] private UserContract.UserContractClient UserClient { get; set; } = default!;
[Inject] private AuthService AuthService { get; set; } = default!;
[CascadingParameter]
private IMudDialogInstance MudDialog { get; set; }
@@ -66,7 +65,6 @@ public partial class AuthDialog : IDisposable
// {
GenerateCaptcha();
// }
var storedPhone = await LocalStorage.GetItemAsync<string>(PhoneStorageKey);
if (!string.IsNullOrWhiteSpace(storedPhone))
{
@@ -227,22 +225,14 @@ public partial class AuthDialog : IDisposable
_attemptsLeft = MaxVerificationAttempts;
_verifyRequest.Code = string.Empty;
await OnLoginSuccess.InvokeAsync();
if (!InlineMode)
{
MudDialog?.Close();
}
if (await AuthService.IsAuthenticatedAsync())
{
if (!(await AuthService.IsCompleteRegisterAsync()))
{
Navigation.NavigateTo(RouteConstants.Registration.Wizard);
}
else
{
Navigation.NavigateTo(RouteConstants.Profile.Index);
}
}
await OnLoginSuccess.InvokeAsync();
// await OnLoginSuccessAsync();
return true;
}
@@ -270,6 +260,7 @@ public partial class AuthDialog : IDisposable
return false;
}
private async Task HandleVerificationFailureAsync(RpcException rpcEx)
{
switch (rpcEx.Status.StatusCode)