feat: validate format of participant emails
This commit is contained in:
@@ -420,8 +420,15 @@
|
|||||||
validateInput () {
|
validateInput () {
|
||||||
let messages = [];
|
let messages = [];
|
||||||
this.invalidParticipantData = {};
|
this.invalidParticipantData = {};
|
||||||
|
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
|
||||||
for (let participant of this.participantData) {
|
for (let participant of this.participantData) {
|
||||||
let participantId = participant.data.id;
|
let participantId = participant.data.id;
|
||||||
|
if (!emailPattern.test(participant.data.email)) {
|
||||||
|
this.invalidParticipantData[participantId] = {
|
||||||
|
invalid: 'E-Mail',
|
||||||
|
};
|
||||||
|
messages.push('Teilnehmer #'+participantId+': ungültige E-Mail-Adresse')
|
||||||
|
}
|
||||||
if (!participant.data.nationality) {
|
if (!participant.data.nationality) {
|
||||||
this.invalidParticipantData[participantId] = {
|
this.invalidParticipantData[participantId] = {
|
||||||
invalid: 'Nationalität',
|
invalid: 'Nationalität',
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
>
|
>
|
||||||
<input class="border-zinc-400 focus:border-zinc-800 ring-0 focus:ring-0 mt-1 w-full"
|
<input class="border-zinc-400 focus:border-zinc-800 ring-0 focus:ring-0 mt-1 w-full"
|
||||||
:class="{'cursor-not-allowed': !mutable }"
|
:class="{'cursor-not-allowed': !mutable }"
|
||||||
type="text" placeholder="E-Mail"
|
type="email" placeholder="E-Mail"
|
||||||
v-model="participant.data.email" :disabled="!mutable"
|
v-model="participant.data.email" :disabled="!mutable"
|
||||||
@change="$emit('updated', participant)"
|
@change="$emit('updated', participant)"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user