mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-02-02 14:16:58 +00:00
fix(validations): Make validations and errors text more specific
This commit is contained in:
parent
e619d6351f
commit
c4f3b76414
|
@ -258,6 +258,7 @@
|
|||
"could_not_create_user": "Couldn't create user",
|
||||
"could_not_delete_user": "Couldn't delete user",
|
||||
"could_not_add_ssh_key": "Couldn't add SSH key",
|
||||
"username_rule": "Must contain only lowercase latin letters, digits and underscores, should not start with a digit",
|
||||
"email_login": "Email login",
|
||||
"no_ssh_notice": "Only email and SSH accounts are created for this user. Single Sign On for all services is coming soon."
|
||||
},
|
||||
|
@ -418,13 +419,13 @@
|
|||
"reset_user_password": "Reset password of user"
|
||||
},
|
||||
"validations": {
|
||||
"required": "Required.",
|
||||
"invalid_format": "Invalid format.",
|
||||
"root_name": "User name cannot be 'root'.",
|
||||
"key_format": "Invalid key format.",
|
||||
"length_not_equal": "Length is []. Should be {}.",
|
||||
"length_longer": "Length is []. Should be shorter than or equal to {}.",
|
||||
"user_already_exist": "This user already exists.",
|
||||
"key_already_exists": "This key already exists."
|
||||
"required": "Required",
|
||||
"already_exist": "Already exists",
|
||||
"invalid_format": "Invalid format",
|
||||
"invalid_format_password": "Must not contain empty characters",
|
||||
"invalid_format_ssh": "Must follow the SSH key format",
|
||||
"root_name": "Cannot be 'root'",
|
||||
"length_not_equal": "Length is [], should be {}",
|
||||
"length_longer": "Length is [], should be shorter than or equal to {}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,6 +258,7 @@
|
|||
"could_not_create_user": "Не удалось создать пользователя",
|
||||
"could_not_delete_user": "Не удалось стереть пользователя",
|
||||
"could_not_add_ssh_key": "Не удалось создать SSH ключить",
|
||||
"username_rule": "Может содержать только маленькие латинские буквы, цифры, подчёркивания, не может начинаться с цифр",
|
||||
"email_login": "Авторизация по Email",
|
||||
"no_ssh_notice": "Для этого пользователя созданы только SSH и Email аккаунты. Единая авторизация для всех сервисов ещё не реализована."
|
||||
},
|
||||
|
@ -419,13 +420,13 @@
|
|||
"reset_user_password": "Сбросить пароль пользователя"
|
||||
},
|
||||
"validations": {
|
||||
"required": "Обязательное поле.",
|
||||
"invalid_format": "Неверный формат.",
|
||||
"root_name": "Имя пользователя не может быть 'root'.",
|
||||
"key_format": "Неверный формат.",
|
||||
"length_not_equal": "Длина строки []. Должно быть равно {}.",
|
||||
"length_longer": "Длина строки []. Должно быть меньше либо равно {}.",
|
||||
"user_already_exist": "Имя уже используется.",
|
||||
"key_already_exists": "Этот ключ уже добавлен."
|
||||
"required": "Обязательное поле",
|
||||
"already_exist": "Уже существует",
|
||||
"invalid_format": "Неверный формат",
|
||||
"invalid_format_password": "Должен не содержать пустые символы",
|
||||
"invalid_format_ssh": "Должен следовать формату SSH ключей",
|
||||
"root_name": "Имя пользователя не может быть 'root'",
|
||||
"length_not_equal": "Длина строки [], должно быть равно {}",
|
||||
"length_longer": "Длина строки [], должно быть меньше либо равно {}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class FieldCubitFactory {
|
|||
ValidationModel(
|
||||
(final String login) =>
|
||||
context.read<UsersCubit>().state.isLoginRegistered(login),
|
||||
'validations.user_already_exist'.tr(),
|
||||
'validations.already_exist'.tr(),
|
||||
),
|
||||
RequiredStringValidation('validations.required'.tr()),
|
||||
LengthStringLongerValidation(userMaxLength),
|
||||
|
@ -52,7 +52,7 @@ class FieldCubitFactory {
|
|||
RequiredStringValidation('validations.required'.tr()),
|
||||
ValidationModel<String>(
|
||||
passwordForbiddenRegExp.hasMatch,
|
||||
'validations.invalid_format'.tr(),
|
||||
'validations.invalid_format_password'.tr(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -14,7 +14,7 @@ class DnsProviderFormCubit extends FormCubit {
|
|||
RequiredStringValidation('validations.required'.tr()),
|
||||
ValidationModel<String>(
|
||||
regExp.hasMatch,
|
||||
'validations.key_format'.tr(),
|
||||
'validations.invalid_format'.tr(),
|
||||
),
|
||||
LengthStringNotEqualValidation(40)
|
||||
],
|
||||
|
|
|
@ -15,7 +15,7 @@ class ProviderFormCubit extends FormCubit {
|
|||
RequiredStringValidation('validations.required'.tr()),
|
||||
ValidationModel<String>(
|
||||
regExp.hasMatch,
|
||||
'validations.key_format'.tr(),
|
||||
'validations.invalid_format'.tr(),
|
||||
),
|
||||
LengthStringNotEqualValidation(64)
|
||||
],
|
||||
|
|
|
@ -21,7 +21,7 @@ class SshFormCubit extends FormCubit {
|
|||
ValidationModel(
|
||||
(final String newKey) =>
|
||||
user.sshKeys.any((final String key) => key == newKey),
|
||||
'validations.key_already_exists'.tr(),
|
||||
'validations.already_exists'.tr(),
|
||||
),
|
||||
RequiredStringValidation('validations.required'.tr()),
|
||||
ValidationModel<String>(
|
||||
|
@ -30,7 +30,7 @@ class SshFormCubit extends FormCubit {
|
|||
print(keyRegExp.hasMatch(s));
|
||||
return !keyRegExp.hasMatch(s);
|
||||
},
|
||||
'validations.invalid_format'.tr(),
|
||||
'validations.invalid_format_ssh'.tr(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -55,6 +55,14 @@ class NewUser extends StatelessWidget {
|
|||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (context.read<UserFormCubit>().state.isErrorShown)
|
||||
Text(
|
||||
'users.username_rule'.tr(),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
IntrinsicHeight(
|
||||
child: CubitFormTextField(
|
||||
formFieldCubit: context.read<UserFormCubit>().login,
|
||||
|
|
Loading…
Reference in a new issue