Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation to the email field #2764

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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