sign up fixes
This commit is contained in:
@@ -53,5 +53,10 @@
|
||||
<false/>
|
||||
<key>NSFaceIDUsageDescription</key>
|
||||
<string>Usamos Face ID para verificar tu identidad y autorizar de forma segura operaciones sensibles dentro de la app.</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -56,6 +56,10 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
|
||||
static final RegExp _phoneRegex = RegExp(r'^\+?\d{6,15}$');
|
||||
|
||||
static final RegExp _nameRegex = RegExp(
|
||||
r"^[a-zA-ZÀ-ÿ\s\-']+$",
|
||||
);
|
||||
|
||||
@override
|
||||
SignUpViewState build() {
|
||||
_signUpUseCase = ref.read(signUpUseCaseProvider);
|
||||
@@ -404,10 +408,18 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
state = state.copyWith(errorMessage: I18n.errorFirstNameRequired);
|
||||
return false;
|
||||
}
|
||||
if (!_nameRegex.hasMatch(state.firstName.trim())) {
|
||||
state = state.copyWith(errorMessage: I18n.errorNameInvalidChars);
|
||||
return false;
|
||||
}
|
||||
if (state.lastName.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorLastNameRequired);
|
||||
return false;
|
||||
}
|
||||
if (!_nameRegex.hasMatch(state.lastName.trim())) {
|
||||
state = state.copyWith(errorMessage: I18n.errorNameInvalidChars);
|
||||
return false;
|
||||
}
|
||||
if (state.documentType.trim().isEmpty) {
|
||||
state = state.copyWith(errorMessage: I18n.errorDocumentTypeRequired);
|
||||
return false;
|
||||
@@ -490,6 +502,7 @@ class SignUpViewModel extends Notifier<SignUpViewState> {
|
||||
String _emailErrorFor(String value) {
|
||||
final email = value.trim();
|
||||
if (email.isEmpty) return I18n.errorEmailRequired;
|
||||
if (email.contains('+')) return I18n.errorEmailPlusNotAllowed;
|
||||
if (!_isValidEmail(email)) return I18n.errorEmailInvalid;
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -175,6 +175,8 @@
|
||||
"errorSigningOperation": "Fehler beim Signieren des Vorgangs",
|
||||
"errorFirstNameRequired": "Vorname ist erforderlich",
|
||||
"errorLastNameRequired": "Nachname ist erforderlich",
|
||||
"errorNameInvalidChars": "Der Name darf nur Buchstaben, Leerzeichen und Bindestriche enthalten",
|
||||
"errorEmailPlusNotAllowed": "Die E-Mail darf kein + Zeichen enthalten",
|
||||
"errorDocumentTypeRequired": "Dokumenttyp ist erforderlich",
|
||||
"errorDocumentNumberRequired": "Dokumentnummer ist erforderlich",
|
||||
"errorAcceptTerms": "Du musst die Allgemeinen Geschäftsbedingungen akzeptieren",
|
||||
|
||||
@@ -175,6 +175,8 @@
|
||||
"errorSigningOperation": "Error signing operation",
|
||||
"errorFirstNameRequired": "First name is required",
|
||||
"errorLastNameRequired": "Last name is required",
|
||||
"errorNameInvalidChars": "Name can only contain letters, spaces and hyphens",
|
||||
"errorEmailPlusNotAllowed": "Email cannot contain the + character",
|
||||
"errorDocumentTypeRequired": "Document type is required",
|
||||
"errorDocumentNumberRequired": "Document number is required",
|
||||
"errorAcceptTerms": "You must accept the terms and conditions",
|
||||
|
||||
@@ -175,6 +175,8 @@
|
||||
"errorSigningOperation": "Error firmando operación sensible",
|
||||
"errorFirstNameRequired": "El nombre es obligatorio",
|
||||
"errorLastNameRequired": "El apellido es obligatorio",
|
||||
"errorNameInvalidChars": "El nombre solo puede contener letras, espacios y guiones",
|
||||
"errorEmailPlusNotAllowed": "El email no puede contener el carácter +",
|
||||
"errorDocumentTypeRequired": "El tipo de documento es obligatorio",
|
||||
"errorDocumentNumberRequired": "El número de documento es obligatorio",
|
||||
"errorAcceptTerms": "Debes aceptar los términos y condiciones",
|
||||
|
||||
@@ -175,6 +175,8 @@
|
||||
"errorSigningOperation": "Erreur lors de la signature de l'opération",
|
||||
"errorFirstNameRequired": "Le prénom est obligatoire",
|
||||
"errorLastNameRequired": "Le nom est obligatoire",
|
||||
"errorNameInvalidChars": "Le nom ne peut contenir que des lettres, des espaces et des tirets",
|
||||
"errorEmailPlusNotAllowed": "L'email ne peut pas contenir le caractère +",
|
||||
"errorDocumentTypeRequired": "Le type de document est obligatoire",
|
||||
"errorDocumentNumberRequired": "Le numéro de document est obligatoire",
|
||||
"errorAcceptTerms": "Vous devez accepter les conditions générales",
|
||||
|
||||
@@ -175,6 +175,8 @@
|
||||
"errorSigningOperation": "Errore durante la firma dell'operazione",
|
||||
"errorFirstNameRequired": "Il nome è obbligatorio",
|
||||
"errorLastNameRequired": "Il cognome è obbligatorio",
|
||||
"errorNameInvalidChars": "Il nome può contenere solo lettere, spazi e trattini",
|
||||
"errorEmailPlusNotAllowed": "L'email non può contenere il carattere +",
|
||||
"errorDocumentTypeRequired": "Il tipo di documento è obbligatorio",
|
||||
"errorDocumentNumberRequired": "Il numero di documento è obbligatorio",
|
||||
"errorAcceptTerms": "Devi accettare i termini e condizioni",
|
||||
|
||||
@@ -175,6 +175,8 @@
|
||||
"errorSigningOperation": "Erro ao assinar a operação",
|
||||
"errorFirstNameRequired": "O nome é obrigatório",
|
||||
"errorLastNameRequired": "O apelido é obrigatório",
|
||||
"errorNameInvalidChars": "O nome só pode conter letras, espaços e hífens",
|
||||
"errorEmailPlusNotAllowed": "O email não pode conter o caractere +",
|
||||
"errorDocumentTypeRequired": "O tipo de documento é obrigatório",
|
||||
"errorDocumentNumberRequired": "O número de documento é obrigatório",
|
||||
"errorAcceptTerms": "Deves aceitar os termos e condições",
|
||||
|
||||
@@ -219,6 +219,8 @@ class I18n {
|
||||
static const String errorSigningOperation = 'errorSigningOperation';
|
||||
static const String errorFirstNameRequired = 'errorFirstNameRequired';
|
||||
static const String errorLastNameRequired = 'errorLastNameRequired';
|
||||
static const String errorNameInvalidChars = 'errorNameInvalidChars';
|
||||
static const String errorEmailPlusNotAllowed = 'errorEmailPlusNotAllowed';
|
||||
static const String errorDocumentTypeRequired = 'errorDocumentTypeRequired';
|
||||
static const String errorDocumentNumberRequired =
|
||||
'errorDocumentNumberRequired';
|
||||
|
||||
Reference in New Issue
Block a user