forked from eatvio/eatvio_app
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:
@@ -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,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -353,7 +353,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
errors.add(s.email_empty);
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
if (password.length < 8) {
|
||||
errors.add(s.password_short);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user