wip: error registration ui feedback
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4a5b9d2569
commit
9ac14e8a5d
@ -2,32 +2,57 @@
|
|||||||
<div class="min-h-screen flex items-center justify-center">
|
<div class="min-h-screen flex items-center justify-center">
|
||||||
<div class="max-w-md w-full py-12 px-6">
|
<div class="max-w-md w-full py-12 px-6">
|
||||||
<img class="mx-auto h-24 w-auto" src="/favicon.png" alt />
|
<img class="mx-auto h-24 w-auto" src="/favicon.png" alt />
|
||||||
<h1
|
<h1 class="sm:text-3xl text-2xl font-medium title-font mb-4 text-center">
|
||||||
class="sm:text-3xl text-2xl font-medium title-font mb-4 text-center"
|
Lauf für Kaya! - {{ $t("registrieren") }}
|
||||||
>Lauf für Kaya! - {{ $t('registrieren') }}</h1>
|
</h1>
|
||||||
<p class="mx-auto leading-relaxed text-base text-center">{{ $t('register.register_now') }}</p>
|
<p class="mx-auto leading-relaxed text-base text-center">
|
||||||
|
{{ $t("register.register_now") }}
|
||||||
|
</p>
|
||||||
<p
|
<p
|
||||||
v-if="state.org_name !== ''"
|
v-if="state.org_name !== ''"
|
||||||
class="mx-auto leading-relaxed text-base text-center"
|
class="mx-auto leading-relaxed text-base text-center"
|
||||||
>{{ $t('organization') }}: {{ state.org_name }}</p>
|
>
|
||||||
|
{{ $t("organization") }}: {{ state.org_name }}
|
||||||
|
</p>
|
||||||
<p
|
<p
|
||||||
v-if="state.org_name !== '' && state.org_teams.length > 0"
|
v-if="state.org_name !== '' && state.org_teams.length > 0"
|
||||||
class="mx-auto leading-relaxed text-base text-center"
|
class="mx-auto leading-relaxed text-base text-center"
|
||||||
>Team:</p>
|
>
|
||||||
|
Team:
|
||||||
|
</p>
|
||||||
<select
|
<select
|
||||||
v-model="org_team"
|
v-model="org_team"
|
||||||
v-if="state.org_name !== '' && state.org_teams.length > 0"
|
v-if="state.org_name !== '' && state.org_teams.length > 0"
|
||||||
class="w-full border bg-white rounded px-3 py-2 outline-none block mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
|
class="
|
||||||
|
w-full
|
||||||
|
border
|
||||||
|
bg-white
|
||||||
|
rounded
|
||||||
|
px-3
|
||||||
|
py-2
|
||||||
|
outline-none
|
||||||
|
block
|
||||||
|
mt-1
|
||||||
|
text-sm
|
||||||
|
dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700
|
||||||
|
form-select
|
||||||
|
focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
|
||||||
|
dark:focus:shadow-outline-gray
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<option v-for="t in state.org_teams" :key="t.id" :value="t.id">{{ t.name }}</option>
|
<option v-for="t in state.org_teams" :key="t.id" :value="t.id">
|
||||||
|
{{ t.name }}
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<p
|
<p
|
||||||
v-if="state.org_name === ''"
|
v-if="state.org_name === ''"
|
||||||
class="mx-auto leading-relaxed text-base text-center"
|
class="mx-auto leading-relaxed text-base text-center"
|
||||||
>Bürgerlauf</p>
|
>
|
||||||
|
Bürgerlauf
|
||||||
|
</p>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<label for="first_name" class="block font-medium">
|
<label for="first_name" class="block font-medium">
|
||||||
{{ $t('vorname') }}
|
{{ $t("vorname") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -37,11 +62,28 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:placeholder="[[$t('vorname')]]"
|
:placeholder="[[$t('vorname')]]"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ 'border-red-500': (!userdetails.firstname.trim()), 'border-green-300': (userdetails.firstname.trim()) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500': !userdetails.firstname.trim(),
|
||||||
|
'border-green-300': userdetails.firstname.trim(),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<label for="middle_name" class="block font-medium">{{ $t('mittelname') }}</label>
|
<label for="middle_name" class="block font-medium">{{
|
||||||
|
$t("mittelname")
|
||||||
|
}}</label>
|
||||||
<input
|
<input
|
||||||
v-model="userdetails.middlename"
|
v-model="userdetails.middlename"
|
||||||
name="middlename"
|
name="middlename"
|
||||||
@ -49,11 +91,23 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:placeholder="[[$t('mittelname')]]"
|
:placeholder="[[$t('mittelname')]]"
|
||||||
type="text"
|
type="text"
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<label for="last_name" class="block font-medium">
|
<label for="last_name" class="block font-medium">
|
||||||
{{ $t('nachname') }}
|
{{ $t("nachname") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -63,12 +117,27 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:placeholder="[[$t('nachname')]]"
|
:placeholder="[[$t('nachname')]]"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ 'border-red-500': (!userdetails.lastname.trim()), 'border-green-300': (userdetails.lastname.trim()) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500': !userdetails.lastname.trim(),
|
||||||
|
'border-green-300': userdetails.lastname.trim(),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<label for="email_address" class="block font-medium">
|
<label for="email_address" class="block font-medium">
|
||||||
{{ $t('e_mail_adress') }}
|
{{ $t("e_mail_adress") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -78,12 +147,31 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:placeholder="[[$t('e_mail_adress')]]"
|
:placeholder="[[$t('e_mail_adress')]]"
|
||||||
type="email"
|
type="email"
|
||||||
:class="{ 'border-red-500': (!isEmail(userdetails.mail)), 'border-green-300': (isEmail(userdetails.mail)) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500': !isEmail(userdetails.mail),
|
||||||
|
'border-green-300': isEmail(userdetails.mail),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<p v-if="!isEmail(userdetails.mail)" class="text-sm">{{ $t('please_provide_valid_mail') }}</p>
|
<p v-if="!isEmail(userdetails.mail)" class="text-sm">
|
||||||
|
{{ $t("please_provide_valid_mail") }}
|
||||||
|
</p>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<label for="phone" class="select-none block font-medium">{{ $t('phone_number') }}</label>
|
<label for="phone" class="select-none block font-medium">{{
|
||||||
|
$t("phone_number")
|
||||||
|
}}</label>
|
||||||
<input
|
<input
|
||||||
v-model="userdetails.phone"
|
v-model="userdetails.phone"
|
||||||
name="phone"
|
name="phone"
|
||||||
@ -91,13 +179,32 @@
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:placeholder="[[$t('phone_number')]]"
|
:placeholder="[[$t('phone_number')]]"
|
||||||
type="text"
|
type="text"
|
||||||
:class="{ 'border-red-500': (!isMobilePhone(userdetails.phone) && userdetails.phone.trim()), 'border-green-300': (isMobilePhone(userdetails.phone) && userdetails.phone.trim()) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500':
|
||||||
|
!isMobilePhone(userdetails.phone) && userdetails.phone.trim(),
|
||||||
|
'border-green-300':
|
||||||
|
isMobilePhone(userdetails.phone) && userdetails.phone.trim(),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<p
|
<p
|
||||||
v-if="(!isMobilePhone(userdetails.phone) && userdetails.phone.trim())"
|
v-if="!isMobilePhone(userdetails.phone) && userdetails.phone.trim()"
|
||||||
class="text-sm"
|
class="text-sm"
|
||||||
>{{ $t('this_is_not_a_valid_international_phone_number') }}</p>
|
>
|
||||||
|
{{ $t("this_is_not_a_valid_international_phone_number") }}
|
||||||
|
</p>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div class="grid grid-cols-6 mt-6">
|
<div class="grid grid-cols-6 mt-6">
|
||||||
<div class="col-span-6"></div>
|
<div class="col-span-6"></div>
|
||||||
@ -115,13 +222,14 @@
|
|||||||
<label
|
<label
|
||||||
for="address_activated"
|
for="address_activated"
|
||||||
class="font-medium text-gray-400 select-none"
|
class="font-medium text-gray-400 select-none"
|
||||||
>{{ $t('provide_address') }}</label>
|
>{{ $t("provide_address") }}</label
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="provide_address === true" class="col-span-6">
|
<div v-if="provide_address === true" class="col-span-6">
|
||||||
<div class="col-span-6">
|
<div class="col-span-6">
|
||||||
<label for="street" class="block font-medium">
|
<label for="street" class="block font-medium">
|
||||||
{{ $t('strasse') }}
|
{{ $t("strasse") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -131,12 +239,29 @@
|
|||||||
:placeholder="[[$t('strasse')]]"
|
:placeholder="[[$t('strasse')]]"
|
||||||
id="street"
|
id="street"
|
||||||
autocomplete="street-address"
|
autocomplete="street-address"
|
||||||
:class="{ 'border-red-500': (!userdetails.address.street.trim()), 'border-green-300': (userdetails.address.street.trim()) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500': !userdetails.address.street.trim(),
|
||||||
|
'border-green-300': userdetails.address.street.trim(),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-6">
|
<div class="col-span-6">
|
||||||
<label for="address2" class="block font-medium">{{ $t('apartment_suite_etc') }}</label>
|
<label for="address2" class="block font-medium">{{
|
||||||
|
$t("apartment_suite_etc")
|
||||||
|
}}</label>
|
||||||
<input
|
<input
|
||||||
v-model="userdetails.address.address2"
|
v-model="userdetails.address.address2"
|
||||||
type="text"
|
type="text"
|
||||||
@ -144,12 +269,24 @@
|
|||||||
:placeholder="[[$t('apartment_suite_etc')]]"
|
:placeholder="[[$t('apartment_suite_etc')]]"
|
||||||
id="address2"
|
id="address2"
|
||||||
autocomplete="street-address"
|
autocomplete="street-address"
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-6 sm:col-span-6 lg:col-span-2">
|
<div class="col-span-6 sm:col-span-6 lg:col-span-2">
|
||||||
<label for="city" class="block font-medium">
|
<label for="city" class="block font-medium">
|
||||||
{{ $t('ort') }}
|
{{ $t("ort") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -158,13 +295,28 @@
|
|||||||
name="city"
|
name="city"
|
||||||
:placeholder="[[$t('ort')]]"
|
:placeholder="[[$t('ort')]]"
|
||||||
id="city"
|
id="city"
|
||||||
:class="{ 'border-red-500': (!userdetails.address.city.trim()), 'border-green-300': (userdetails.address.city.trim()) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500': !userdetails.address.city.trim(),
|
||||||
|
'border-green-300': userdetails.address.city.trim(),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-6 sm:col-span-3 lg:col-span-2">
|
<div class="col-span-6 sm:col-span-3 lg:col-span-2">
|
||||||
<label for="postal_code" class="block font-medium">
|
<label for="postal_code" class="block font-medium">
|
||||||
{{ $t('plz') }}
|
{{ $t("plz") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -174,14 +326,37 @@
|
|||||||
:placeholder="[[$t('plz')]]"
|
:placeholder="[[$t('plz')]]"
|
||||||
id="postal_code"
|
id="postal_code"
|
||||||
autocomplete="postal-code"
|
autocomplete="postal-code"
|
||||||
:class="{ 'border-red-500': (!isPostalCode(userdetails.address.zipcode, 'DE')), 'border-green-300': (isPostalCode(userdetails.address.zipcode, 'DE')) }"
|
:class="{
|
||||||
class="dark:bg-gray-800 mt-1 block w-full shadow-sm sm:text-sm border-gray-300 border-2 bg-gray-50 text-gray-500 rounded-md p-2"
|
'border-red-500': !isPostalCode(
|
||||||
|
userdetails.address.zipcode,
|
||||||
|
'DE'
|
||||||
|
),
|
||||||
|
'border-green-300': isPostalCode(
|
||||||
|
userdetails.address.zipcode,
|
||||||
|
'DE'
|
||||||
|
),
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
dark:bg-gray-800
|
||||||
|
mt-1
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
shadow-sm
|
||||||
|
sm:text-sm
|
||||||
|
border-gray-300 border-2
|
||||||
|
bg-gray-50
|
||||||
|
text-gray-500
|
||||||
|
rounded-md
|
||||||
|
p-2
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
v-if="!isPostalCode(userdetails.address.zipcode, 'DE')"
|
v-if="!isPostalCode(userdetails.address.zipcode, 'DE')"
|
||||||
class="text-sm"
|
class="text-sm"
|
||||||
>{{ $t('please_provide_a_valid_zipcode') }}</p>
|
>
|
||||||
|
{{ $t("please_provide_a_valid_zipcode") }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-start mt-6">
|
<div class="flex items-start mt-6">
|
||||||
@ -195,15 +370,19 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-3 text-sm">
|
<div class="ml-3 text-sm">
|
||||||
<label for="agb_accepted" class="font-medium text-gray-400 select-none">
|
<label
|
||||||
{{ $t('i_accept', { tos: $t('tos') }) }}
|
for="agb_accepted"
|
||||||
|
class="font-medium text-gray-400 select-none"
|
||||||
|
>
|
||||||
|
{{ $t("i_accept", { tos: $t("tos") }) }}
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer,noopener"
|
rel="noreferrer,noopener"
|
||||||
href="https://lauf-fuer-kaya.de/datenschutz/"
|
href="https://lauf-fuer-kaya.de/datenschutz/"
|
||||||
class="underline"
|
class="underline"
|
||||||
>{{ $t('tos') }}</a>
|
>{{ $t("tos") }}</a
|
||||||
{{ $t('i_accept_end') }}
|
>
|
||||||
|
{{ $t("i_accept_end") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@ -219,8 +398,11 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-3 text-sm">
|
<div class="ml-3 text-sm">
|
||||||
<label for="data_confirmed" class="font-medium text-gray-400 select-none">
|
<label
|
||||||
{{ $t('confirm_personal_data') }}
|
for="data_confirmed"
|
||||||
|
class="font-medium text-gray-400 select-none"
|
||||||
|
>
|
||||||
|
{{ $t("confirm_personal_data") }}
|
||||||
<span class="font-bold">*</span>
|
<span class="font-bold">*</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@ -228,10 +410,30 @@
|
|||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<button
|
<button
|
||||||
@click="login"
|
@click="login"
|
||||||
:disabled="(!state.submit_enabled)"
|
:disabled="!state.submit_enabled"
|
||||||
:class="{ 'opacity-50': (!state.submit_enabled), 'cursor-not-allowed': (!state.submit_enabled) }"
|
:class="{
|
||||||
class="text-white block w-full text-center py-2 px-3 border-2 border-gray-300 rounded-md p-1 bg-blue-800 font-medium hover:border-gray-400 focus:outline-none focus:border-gray-400 sm:text-sm"
|
'opacity-50': !state.submit_enabled,
|
||||||
>{{ $t('registrieren') }}</button>
|
'cursor-not-allowed': !state.submit_enabled,
|
||||||
|
}"
|
||||||
|
class="
|
||||||
|
text-white
|
||||||
|
block
|
||||||
|
w-full
|
||||||
|
text-center
|
||||||
|
py-2
|
||||||
|
px-3
|
||||||
|
border-2 border-gray-300
|
||||||
|
rounded-md
|
||||||
|
p-1
|
||||||
|
bg-blue-800
|
||||||
|
font-medium
|
||||||
|
hover:border-gray-400
|
||||||
|
focus:outline-none focus:border-gray-400
|
||||||
|
sm:text-sm
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ $t("registrieren") }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -241,16 +443,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, reactive, defineProps } from "vue";
|
import { computed, ref, reactive, defineProps } from "vue";
|
||||||
import axios from "redaxios";
|
import axios from "redaxios";
|
||||||
import isEmail from 'validator/es/lib/isEmail';
|
import isEmail from "validator/es/lib/isEmail";
|
||||||
import isMobilePhone from 'validator/es/lib/isMobilePhone';
|
import isMobilePhone from "validator/es/lib/isMobilePhone";
|
||||||
import isPostalCode from 'validator/es/lib/isPostalCode';
|
import isPostalCode from "validator/es/lib/isPostalCode";
|
||||||
import { useToast } from "vue-toastification";
|
import { TYPE, useToast } from "vue-toastification";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
token: String
|
token: String,
|
||||||
})
|
});
|
||||||
if (props.token) {
|
if (props.token) {
|
||||||
axios.get(`${config.baseurl}api/organizations/selfservice/${props.token}`)
|
axios
|
||||||
|
.get(`${config.baseurl}api/organizations/selfservice/${props.token}`)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
state.org_name = data.name;
|
state.org_name = data.name;
|
||||||
state.org_teams = data.teams;
|
state.org_teams = data.teams;
|
||||||
@ -261,31 +464,50 @@ if (props.token) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let userdetails = ref({ firstname: "", lastname: "", middlename: "", mail: "", phone: "", address: { street: "", address2: "", city: "", zipcode: "" } });
|
let userdetails = ref({
|
||||||
|
firstname: "",
|
||||||
|
lastname: "",
|
||||||
|
middlename: "",
|
||||||
|
mail: "",
|
||||||
|
phone: "",
|
||||||
|
address: { street: "", address2: "", city: "", zipcode: "" },
|
||||||
|
});
|
||||||
let provide_address = ref(false);
|
let provide_address = ref(false);
|
||||||
let agb_accepted = ref(false);
|
let agb_accepted = ref(false);
|
||||||
let data_confirmed = ref(false);
|
let data_confirmed = ref(false);
|
||||||
let org_team = ref("");
|
let org_team = ref("");
|
||||||
//
|
//
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
org_name: "",
|
org_name: "",
|
||||||
org_teams: [],
|
org_teams: [],
|
||||||
submit_enabled: computed(() => agb_accepted.value === true && data_confirmed.value === true && (isMobilePhone(userdetails.value.phone) || !userdetails.value.phone.trim()) && isEmail(userdetails.value.mail)
|
submit_enabled: computed(
|
||||||
&& userdetails.value.firstname
|
() =>
|
||||||
&& userdetails.value.lastname && (provide_address.value === false || provide_address.value === true && (userdetails.value.address.street.trim() && userdetails.value.address.city.trim() && isPostalCode(userdetails.value.address.zipcode, "DE"))))
|
agb_accepted.value === true &&
|
||||||
})
|
data_confirmed.value === true &&
|
||||||
|
(isMobilePhone(userdetails.value.phone) ||
|
||||||
|
!userdetails.value.phone.trim()) &&
|
||||||
|
isEmail(userdetails.value.mail) &&
|
||||||
|
userdetails.value.firstname &&
|
||||||
|
userdetails.value.lastname &&
|
||||||
|
(provide_address.value === false ||
|
||||||
|
(provide_address.value === true &&
|
||||||
|
userdetails.value.address.street.trim() &&
|
||||||
|
userdetails.value.address.city.trim() &&
|
||||||
|
isPostalCode(userdetails.value.address.zipcode, "DE")))
|
||||||
|
),
|
||||||
|
});
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
function login() {
|
function login() {
|
||||||
userdetails = userdetails.value;
|
userdetails = userdetails.value;
|
||||||
if (userdetails?.phone === "" || isMobilePhone(userdetails.phone)) {
|
if (userdetails?.phone === "" || isMobilePhone(userdetails.phone)) {
|
||||||
if (isEmail(userdetails.mail)) {
|
if (isEmail(userdetails.mail)) {
|
||||||
let postdata = {
|
let postdata = {
|
||||||
"email": userdetails.mail,
|
email: userdetails.mail,
|
||||||
"firstname": userdetails.firstname,
|
firstname: userdetails.firstname,
|
||||||
"middlename": userdetails.middlename,
|
middlename: userdetails.middlename,
|
||||||
"lastname": userdetails.lastname,
|
lastname: userdetails.lastname,
|
||||||
"address": {}
|
address: {},
|
||||||
}
|
};
|
||||||
if (isMobilePhone(userdetails.phone)) {
|
if (isMobilePhone(userdetails.phone)) {
|
||||||
postdata.phone = userdetails.phone;
|
postdata.phone = userdetails.phone;
|
||||||
}
|
}
|
||||||
@ -296,23 +518,34 @@ function login() {
|
|||||||
city: userdetails.address.city,
|
city: userdetails.address.city,
|
||||||
postalcode: userdetails.address.zipcode,
|
postalcode: userdetails.address.zipcode,
|
||||||
country: "DE",
|
country: "DE",
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
if (state.org_name !== '' && state.org_teams.length > 0) {
|
if (state.org_name !== "" && state.org_teams.length > 0) {
|
||||||
postdata.team = org_team.value;
|
postdata.team = org_team.value;
|
||||||
}
|
}
|
||||||
toast("Registrierung läuft...");
|
toast("Registrierung läuft...");
|
||||||
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
|
const browserlocale = (
|
||||||
|
(navigator.languages && navigator.languages[0]) ||
|
||||||
|
""
|
||||||
|
).substr(0, 2);
|
||||||
let url = `${config.baseurl}api/runners/register/?locale=${browserlocale}`;
|
let url = `${config.baseurl}api/runners/register/?locale=${browserlocale}`;
|
||||||
if (props.token) {
|
if (props.token) {
|
||||||
url = `${config.baseurl}api/runners/register/${props.token}/?locale=${browserlocale}`
|
url = `${config.baseurl}api/runners/register/${props.token}/?locale=${browserlocale}`;
|
||||||
}
|
}
|
||||||
axios.post(url, postdata)
|
axios
|
||||||
|
.post(url, postdata)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
location.replace(`${config.baseurl_selfservice}registered/?mail=${encodeURIComponent(postdata.email)}`);
|
location.replace(
|
||||||
|
`${config.baseurl_selfservice}registered/?mail=${encodeURIComponent(
|
||||||
|
postdata.email
|
||||||
|
)}`
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
if (error.data.message === "E-Mail already registered") {
|
||||||
|
toast("bereits registriert...", { type: TYPE.ERROR });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user