feat(auth): align password policy and handle 429 responses

- map 429 Retry-After to a localized toast in AuthCubit
- enforce the 8-character minimum on registration v1 and add the hint
- surface errors.password in registration v2
- show password errors from 422 responses in the reset flow
- add ru/en localization strings and regenerate l10n
- add a regression test for the 429/Retry-After path
This commit is contained in:
2026-11-23 14:46:29 +03:00
parent 78192b742d
commit b0ffbd318a
17 changed files with 271 additions and 120 deletions

View File

@@ -53,7 +53,9 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
textInputAction: TextInputAction.next,
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(email: newValue));
registrationCubit.updateSheet(
registrationCubit.state.sheet.copyWith(email: newValue),
);
},
),
const SizedBox(height: 16),
@@ -71,15 +73,24 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
});
},
icon: Icon(
hidePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
hidePassword
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
color: Colors.grey,
),
),
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(password: newValue));
registrationCubit.updateSheet(
registrationCubit.state.sheet.copyWith(password: newValue),
);
},
),
const SizedBox(height: 4),
Text(
s.password_hint,
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
const SizedBox(height: 16),
Text(s.password_confirmation),
const SizedBox(height: 4),
@@ -95,13 +106,19 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
});
},
icon: Icon(
hidePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
hidePassword
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
color: Colors.grey,
),
),
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(passwordConfirmation: newValue));
registrationCubit.updateSheet(
registrationCubit.state.sheet.copyWith(
passwordConfirmation: newValue,
),
);
},
),
],