From e86cb7aa47d8ef82c847f23de7f555f75c366b1d Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Fri, 14 Nov 2025 10:49:46 +0330 Subject: [PATCH] Refactor AuthDialog to remove captcha handling and improve dialog display options --- .../Pages/RegisterWizard.razor | 10 +- .../Pages/RegisterWizard.razor.cs | 4 + src/FrontOffice.Main/Shared/AuthDialog.razor | 8 +- .../Shared/AuthDialog.razor.cs | 22 ++-- .../Utilities/AuthDialogService.cs | 4 +- src/FrontOffice.Main/wwwroot/css/site.css | 119 +++++++++++++++--- 6 files changed, 133 insertions(+), 34 deletions(-) diff --git a/src/FrontOffice.Main/Pages/RegisterWizard.razor b/src/FrontOffice.Main/Pages/RegisterWizard.razor index c52f4f8..fdf5cb3 100644 --- a/src/FrontOffice.Main/Pages/RegisterWizard.razor +++ b/src/FrontOffice.Main/Pages/RegisterWizard.razor @@ -5,7 +5,7 @@
- + ثبت‌نام سه مرحله‌ای @@ -15,7 +15,7 @@ اطلاعات اولیه را وارد کنید، مشخصات هویتی را تکمیل کنید و بعد از مطالعه قوانین و دانلود قرارداد، درخواست خود را ارسال کنید. - + @@ -56,7 +56,7 @@ } else { - + ویزارد ثبت‌نام ۳ مرحله @@ -68,11 +68,11 @@ } - + @* Inline AuthDialog with captcha enabled *@ - + diff --git a/src/FrontOffice.Main/Pages/RegisterWizard.razor.cs b/src/FrontOffice.Main/Pages/RegisterWizard.razor.cs index 140f0b7..d343f0d 100644 --- a/src/FrontOffice.Main/Pages/RegisterWizard.razor.cs +++ b/src/FrontOffice.Main/Pages/RegisterWizard.razor.cs @@ -142,6 +142,10 @@ public partial class RegisterWizard _updateUserRequest.FirstName = _model.FirstName; _updateUserRequest.LastName = _model.LastName; _updateUserRequest.NationalCode = _model.NationalCode.PersianToEnglish(); + Console.WriteLine(_updateUserRequest.FirstName); + Console.WriteLine(_updateUserRequest.LastName); + Console.WriteLine(_updateUserRequest.NationalCode); + await UserContract.UpdateUserAsync(request: _updateUserRequest); Snackbar.Add("اطلاعات شخصی با موفقیت ذخیره شد.", Severity.Success); return true; diff --git a/src/FrontOffice.Main/Shared/AuthDialog.razor b/src/FrontOffice.Main/Shared/AuthDialog.razor index 26fcc6e..d4ee175 100644 --- a/src/FrontOffice.Main/Shared/AuthDialog.razor +++ b/src/FrontOffice.Main/Shared/AuthDialog.razor @@ -8,7 +8,7 @@ } else { - + @GetDialogTitle() @@ -72,8 +72,8 @@ else HelperText="مثال: 09121234567" Class="mb-2" /> - @if (EnableCaptcha) - { + @* @if (EnableCaptcha) *@ + @* { *@ @_captchaCode @@ -85,7 +85,7 @@ else - } + @* } *@ (PhoneStorageKey); if (!string.IsNullOrWhiteSpace(storedPhone)) { _phoneRequest.Mobile = storedPhone; } + await LocalStorage.RemoveItemAsync(TokenStorageKey); } private void GenerateCaptcha() @@ -87,14 +89,14 @@ public partial class AuthDialog : IDisposable if (!_phoneForm.IsValid) return; - if (EnableCaptcha) - { + // if (EnableCaptcha) + // { if (string.IsNullOrWhiteSpace(_captchaInput) || !string.Equals(_captchaInput.Trim(), _captchaCode, StringComparison.OrdinalIgnoreCase)) { _errorMessage = "کد کپچا صحیح نیست."; return; } - } + // } _isBusy = true; _operationCts?.Cancel(); @@ -368,7 +370,7 @@ public partial class AuthDialog : IDisposable _resendTimer?.Dispose(); _resendTimer = null; _resendRemaining = 0; - if (EnableCaptcha) + // if (EnableCaptcha) GenerateCaptcha(); } @@ -420,7 +422,7 @@ public partial class AuthDialog : IDisposable private void Cancel() { if (!InlineMode) - MudDialog?.Close(DialogResult.Cancel()); + MudDialog?.Close(); } public void Dispose() diff --git a/src/FrontOffice.Main/Utilities/AuthDialogService.cs b/src/FrontOffice.Main/Utilities/AuthDialogService.cs index 32532e7..5486757 100644 --- a/src/FrontOffice.Main/Utilities/AuthDialogService.cs +++ b/src/FrontOffice.Main/Utilities/AuthDialogService.cs @@ -6,6 +6,7 @@ namespace FrontOffice.Main.Utilities; public class AuthDialogService { private readonly IDialogService _dialogService; + private readonly DialogOptions _maxWidth = new() { MaxWidth = MaxWidth.Medium, FullWidth = true, }; public AuthDialogService(IDialogService dialogService) { @@ -14,7 +15,8 @@ public class AuthDialogService public async Task ShowAuthDialogAsync() { - var dialog = await _dialogService.ShowAsync("ورود به حساب کاربری"); + + var dialog = await _dialogService.ShowAsync("ورود به حساب کاربری",_maxWidth); var result = await dialog.Result; if (!result.Canceled) diff --git a/src/FrontOffice.Main/wwwroot/css/site.css b/src/FrontOffice.Main/wwwroot/css/site.css index 5808914..7d74673 100644 --- a/src/FrontOffice.Main/wwwroot/css/site.css +++ b/src/FrontOffice.Main/wwwroot/css/site.css @@ -72,23 +72,106 @@ html, body { } /* Typography variants override to match previous settings */ -.mud-typography-h1 { font-family: var(--app-font-family); font-size: 2rem; font-weight: 700; line-height: 1.70; letter-spacing: normal; } -.mud-typography-h2 { font-family: var(--app-font-family); font-size: 1.875rem; font-weight: 700; line-height: 1.65; letter-spacing: normal; } -.mud-typography-h3 { font-family: var(--app-font-family); font-size: 1.5rem; font-weight: 700; line-height: 1.60; letter-spacing: normal; } -.mud-typography-h4 { font-family: var(--app-font-family); font-size: 1.25rem; font-weight: 700; line-height: 1.55; letter-spacing: normal; } -.mud-typography-h5 { font-family: var(--app-font-family); font-size: 1.125rem; font-weight: 700; line-height: 1.50; letter-spacing: normal; } -.mud-typography-h6 { font-family: var(--app-font-family); font-size: 1rem; font-weight: 700; line-height: 1.45; letter-spacing: normal; } +.mud-typography-h1 { + font-family: var(--app-font-family); + font-size: 2rem; + font-weight: 700; + line-height: 1.70; + letter-spacing: normal; +} -.mud-typography-subtitle1 { font-family: var(--app-font-family); font-size: 1rem; font-weight: 500; line-height: 1.62; letter-spacing: normal; } -.mud-typography-subtitle2 { font-family: var(--app-font-family); font-size: 0.875rem; font-weight: 500; line-height: 1.60; letter-spacing: normal; } +.mud-typography-h2 { + font-family: var(--app-font-family); + font-size: 1.875rem; + font-weight: 700; + line-height: 1.65; + letter-spacing: normal; +} -.mud-typography-body1 { font-family: var(--app-font-family); font-size: 1rem; font-weight: 400; line-height: 1.85; letter-spacing: normal; } -.mud-typography-body2 { font-family: var(--app-font-family); font-size: 0.875rem; font-weight: 400; line-height: 1.80; letter-spacing: normal; } +.mud-typography-h3 { + font-family: var(--app-font-family); + font-size: 1.5rem; + font-weight: 700; + line-height: 1.60; + letter-spacing: normal; +} -.mud-typography-caption { font-family: var(--app-font-family); font-size: 0.75rem; font-weight: 400; line-height: 1.60; letter-spacing: normal; } -.mud-typography-overline { font-family: var(--app-font-family); font-size: 0.75rem; font-weight: 500; line-height: 1.60; letter-spacing: normal; } +.mud-typography-h4 { + font-family: var(--app-font-family); + font-size: 1.25rem; + font-weight: 700; + line-height: 1.55; + letter-spacing: normal; +} + +.mud-typography-h5 { + font-family: var(--app-font-family); + font-size: 1.125rem; + font-weight: 700; + line-height: 1.50; + letter-spacing: normal; +} + +.mud-typography-h6 { + font-family: var(--app-font-family); + font-size: 1rem; + font-weight: 700; + line-height: 1.45; + letter-spacing: normal; +} + +.mud-typography-subtitle1 { + font-family: var(--app-font-family); + font-size: 1rem; + font-weight: 500; + line-height: 1.62; + letter-spacing: normal; +} + +.mud-typography-subtitle2 { + font-family: var(--app-font-family); + font-size: 0.875rem; + font-weight: 500; + line-height: 1.60; + letter-spacing: normal; +} + +.mud-typography-body1 { + font-family: var(--app-font-family); + font-size: 1rem; + font-weight: 400; + line-height: 1.85; + letter-spacing: normal; +} + +.mud-typography-body2 { + font-family: var(--app-font-family); + font-size: 0.875rem; + font-weight: 400; + line-height: 1.80; + letter-spacing: normal; +} + +.mud-typography-caption { + font-family: var(--app-font-family); + font-size: 0.75rem; + font-weight: 400; + line-height: 1.60; + letter-spacing: normal; +} + +.mud-typography-overline { + font-family: var(--app-font-family); + font-size: 0.75rem; + font-weight: 500; + line-height: 1.60; + letter-spacing: normal; +} + +.mud-button-label { + text-transform: none; +} -.mud-button-label { text-transform: none; } /*#endregion*/ /*#region Layout Styles*/ @@ -111,6 +194,7 @@ html, body { .mud-main-content > div:first-child { flex: 1; } + /*#endregion*/ /*#region Footer Styles*/ @@ -244,6 +328,7 @@ html, body { .mud-theme-dark .stats-grid .mud-paper { background: linear-gradient(135deg, var(--mud-palette-dark-surface) 0%, var(--mud-palette-dark-surface-variant) 100%); } + /*#endregion*/ /*#region Registration Wizard*/ .wizard-section { @@ -259,7 +344,7 @@ html, body { border-radius: 16px; border: 1px solid transparent; background: linear-gradient(var(--mud-palette-surface), var(--mud-palette-surface)) padding-box, - linear-gradient(135deg, rgba(123, 97, 255, 0.4), rgba(255, 140, 189, 0.4)) border-box; + linear-gradient(135deg, rgba(123, 97, 255, 0.4), rgba(255, 140, 189, 0.4)) border-box; } .captcha-box { @@ -282,5 +367,11 @@ html, body { padding: 1.5rem !important; } } + /*#endregion*/ /*#endregion*/ +@media (max-width: 768px) { + #registration-stepper .mud-stepper-content { + padding: 0 10px !important; + } +} \ No newline at end of file