From a67f84dee9e4ddbf026e0a46ac326ca22c2cdde7 Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Mon, 15 Sep 2025 23:01:15 +0330 Subject: [PATCH] some bug fix --- hesabixAPI/app/core/i18n.py | 2 ++ hesabixAPI/app/services/auth_service.py | 4 ++++ hesabixAPI/locales/fa/LC_MESSAGES/messages.mo | Bin 1494 -> 1636 bytes hesabixAPI/locales/fa/LC_MESSAGES/messages.po | 3 +++ .../lib/l10n/app_localizations_fa.dart | 3 ++- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hesabixAPI/app/core/i18n.py b/hesabixAPI/app/core/i18n.py index b4f3854..b176ac6 100644 --- a/hesabixAPI/app/core/i18n.py +++ b/hesabixAPI/app/core/i18n.py @@ -38,6 +38,7 @@ class Translator: "INVALID_IDENTIFIER": "Identifier must be a valid email or mobile number.", "EMAIL_IN_USE": "Email is already in use.", "MOBILE_IN_USE": "Mobile number is already in use.", + "INVALID_MOBILE": "Invalid mobile number.", "ACCOUNT_DISABLED": "Your account is disabled.", "RESET_TOKEN_INVALID_OR_EXPIRED": "Reset token is invalid or expired.", "VALIDATION_ERROR": "Validation error", @@ -55,6 +56,7 @@ class Translator: "INVALID_IDENTIFIER": "شناسه باید ایمیل یا شماره موبایل معتبر باشد.", "EMAIL_IN_USE": "این ایمیل قبلاً استفاده شده است.", "MOBILE_IN_USE": "این شماره موبایل قبلاً استفاده شده است.", + "INVALID_MOBILE": "شماره موبایل نامعتبر است.", "ACCOUNT_DISABLED": "حساب کاربری شما غیرفعال است.", "RESET_TOKEN_INVALID_OR_EXPIRED": "توکن بازنشانی نامعتبر یا منقضی شده است.", "VALIDATION_ERROR": "خطای اعتبارسنجی", diff --git a/hesabixAPI/app/services/auth_service.py b/hesabixAPI/app/services/auth_service.py index 486dce8..b02b959 100644 --- a/hesabixAPI/app/services/auth_service.py +++ b/hesabixAPI/app/services/auth_service.py @@ -54,6 +54,10 @@ def register_user(*, db: Session, first_name: str | None, last_name: str | None, mobile_n = _normalize_mobile(mobile) if not email_n and not mobile_n: from app.core.responses import ApiError + # اگر کاربر موبایل وارد کرده اما نامعتبر بوده، پیام دقیق‌تر بدهیم + if mobile and mobile.strip(): + raise ApiError("INVALID_MOBILE", "Invalid mobile number") + # در غیر این صورت، هیچ شناسهٔ معتبری ارائه نشده است raise ApiError("IDENTIFIER_REQUIRED", "Email or mobile is required") repo = UserRepository(db) diff --git a/hesabixAPI/locales/fa/LC_MESSAGES/messages.mo b/hesabixAPI/locales/fa/LC_MESSAGES/messages.mo index 1dbf568044c964f627554121bec06feea586dabc..82939fa76684ff902036299cbdd6e2c6f9593b70 100644 GIT binary patch delta 446 zcmYk$KS%;m90%~r5Q(Ulupgq0n8Yrm2>gC(ml-7AtdOle22SDO6f@ zRxz^s^=iXZYX|+3J!&EXi#vyLC=O9gaRj_sl}G(oa{A( z&`^WWD{vA5mz$h>1qb$h;J^nSKELmCf4A1};Uu=RGr=mdOYCOUPFvNR&#U^g>0IQ~M-c)C(axg*{BP`>$sp>|gR>rgPGjGQi?OyQc gRr*1$6%50tAnfT-mb{joc0>8n{d|#Mh8md3KhLo%kpKVy diff --git a/hesabixAPI/locales/fa/LC_MESSAGES/messages.po b/hesabixAPI/locales/fa/LC_MESSAGES/messages.po index 89c248c..77889fe 100644 --- a/hesabixAPI/locales/fa/LC_MESSAGES/messages.po +++ b/hesabixAPI/locales/fa/LC_MESSAGES/messages.po @@ -52,6 +52,9 @@ msgstr "این ایمیل قبلاً استفاده شده است." msgid "MOBILE_IN_USE" msgstr "این شماره موبایل قبلاً استفاده شده است." +msgid "INVALID_MOBILE" +msgstr "شماره موبایل نامعتبر است." + msgid "ACCOUNT_DISABLED" msgstr "حساب کاربری شما غیرفعال است." diff --git a/hesabixUI/hesabix_ui/lib/l10n/app_localizations_fa.dart b/hesabixUI/hesabix_ui/lib/l10n/app_localizations_fa.dart index e58acd4..38bcb2c 100644 --- a/hesabixUI/hesabix_ui/lib/l10n/app_localizations_fa.dart +++ b/hesabixUI/hesabix_ui/lib/l10n/app_localizations_fa.dart @@ -100,7 +100,8 @@ class AppLocalizationsFa extends AppLocalizations { String get registerFailed => 'عضویت ناموفق بود. لطفاً دوباره تلاش کنید.'; @override - String get resetFailed => 'ارسال کد بازیابی ناموفق بود. لطفاً دوباره تلاش کنید.'; + String get resetFailed => + 'ارسال کد بازیابی ناموفق بود. لطفاً دوباره تلاش کنید.'; @override String get fixFormErrors => 'لطفاً خطاهای فرم را برطرف کنید.';