Skip to content

Commit

Permalink
Merge pull request #2764 from irontec/PROVIDER-2011-validation-to-the…
Browse files Browse the repository at this point in the history
…-email-field

Add validation to the email field
  • Loading branch information
danigargar authored Sep 11, 2024
2 parents e90cbcb + 87e1aea commit ab52992
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions library/Ivoz/Provider/Domain/Model/Voicemail/Voicemail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Ivoz\Provider\Domain\Model\Voicemail;

use Ivoz\Core\Domain\Assert\Assertion;
use Ivoz\Provider\Domain\Model\Language\LanguageInterface;

/**
Expand Down Expand Up @@ -105,4 +106,13 @@ public function getLanguage(): ?LanguageInterface

return $this->getCompany()->getLanguage();
}

protected function setEmail(?string $email = null): static
{
if (!empty($email)) {
Assertion::email($email, 'email is not a valid email address');
}

return parent::setEmail($email);
}
}
1 change: 1 addition & 0 deletions web/portal/client/src/entities/Voicemail/Voicemail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const properties: VoicemailProperties = {
},
email: {
label: _('Email'),
helpText: _('Hint: only one email address is supported'),
required: true,
},
attachSound: {
Expand Down
1 change: 1 addition & 0 deletions web/portal/client/src/translations/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
"Go to Voice Mails": "Anar als missatges de veu",
"Group belonging": "Pertinença a grups",
"Hint": "Pista",
"Hint: only one email address is supported": "Suggeriment: només es permet una adreça de correu electrònic",
"Holiday date range_many": "Rango de festivos",
"Holiday date range_one": "Rango de festivo",
"Holiday date range_other": "Rango de festivos",
Expand Down
1 change: 1 addition & 0 deletions web/portal/client/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
"Go to Voice Mails": "Go to Voice Mails",
"Group belonging": "Group belonging",
"Hint": "Hint",
"Hint: only one email address is supported": "Hint: only one email address is supported",
"Holiday date range_one": "Holiday date range",
"Holiday date range_other": "Holiday dates range",
"Holiday date_one": "Holiday date",
Expand Down
1 change: 1 addition & 0 deletions web/portal/client/src/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
"Go to Voice Mails": "Ir a Mensajes de Voz",
"Group belonging": "Pertenencia a grupos",
"Hint": "Pista",
"Hint: only one email address is supported": "Sugerencia: solo se admite una dirección de correo electrónico",
"Holiday date range_many": "Rango de festivos",
"Holiday date range_one": "Rango de festivo",
"Holiday date range_other": "Rango de festivos",
Expand Down
1 change: 1 addition & 0 deletions web/portal/client/src/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
"Go to Voice Mails": "Vai alle caselle vocali",
"Group belonging": "Appartenenza al gruppo",
"Hint": "Suggerimento",
"Hint: only one email address is supported": "Suggerimento: è supportato solo un indirizzo email",
"Holiday date range_many": "Holiday dates range",
"Holiday date range_one": "Holiday date range",
"Holiday date range_other": "Holiday dates range",
Expand Down

0 comments on commit ab52992

Please sign in to comment.