fix(auth): validation toast and rate limit adjustment
This commit is contained in:
@@ -82,6 +82,15 @@ class _RegisterVerificationViewState extends State<RegisterVerificationView> {
|
||||
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<RegisterVerificationView> {
|
||||
}
|
||||
|
||||
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<RegisterVerificationView> {
|
||||
width: 70,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: borderColor),
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user