From 11666e6492da63aa0cded4a30b56337e7648305f Mon Sep 17 00:00:00 2001 From: qzl Date: Thu, 26 Feb 2026 12:07:40 +0800 Subject: [PATCH] fix(auth): validation toast and rate limit adjustment --- .../ui/screens/register_verification_screen.dart | 15 ++++++++++++--- backend/src/v1/auth/router.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/lib/features/auth/ui/screens/register_verification_screen.dart b/apps/lib/features/auth/ui/screens/register_verification_screen.dart index 2e37ce9..487986d 100644 --- a/apps/lib/features/auth/ui/screens/register_verification_screen.dart +++ b/apps/lib/features/auth/ui/screens/register_verification_screen.dart @@ -82,6 +82,15 @@ class _RegisterVerificationViewState extends State { cubit.verificationCodeChanged(_codeController.text); if (!cubit.state.isStep2Valid) { + String? errorMsg; + if (_codeController.text.isEmpty) { + errorMsg = '请输入验证码'; + } else { + errorMsg = '验证码必须是 6 位数字'; + } + if (mounted) { + Toast.show(context, errorMsg, type: ToastType.warning); + } return; } @@ -260,8 +269,8 @@ class _RegisterVerificationViewState extends State { } Widget _buildResendButton(bool canResend, RegisterState state) { - final borderColor = canResend ? AppColors.primary : AppColors.slate300; - final textColor = canResend ? AppColors.primary : AppColors.slate400; + final bgColor = canResend ? AppColors.primary : const Color(0xFFF1F5F9); + final textColor = canResend ? AppColors.white : AppColors.slate400; String text; if (state.status == FormzSubmissionStatus.inProgress) { @@ -278,7 +287,7 @@ class _RegisterVerificationViewState extends State { width: 70, height: 40, decoration: BoxDecoration( - border: Border.all(color: borderColor), + color: bgColor, borderRadius: BorderRadius.circular(6), ), alignment: Alignment.center, diff --git a/backend/src/v1/auth/router.py b/backend/src/v1/auth/router.py index 0240c0b..9d64f5e 100644 --- a/backend/src/v1/auth/router.py +++ b/backend/src/v1/auth/router.py @@ -63,7 +63,7 @@ async def signup_resend( await enforce_rate_limit( scope="signup_resend", identifier=payload.email, - limit=3, + limit=5, window_seconds=60, ) return await service.signup_resend(payload)