mirror of https://github.com/wg-easy/wg-easy
12 changed files with 183 additions and 134 deletions
@ -1,16 +1,83 @@ |
|||||
<template> |
<template> |
||||
<div> |
<div> |
||||
<p class="px-8 pt-8 text-center text-2xl"> |
<p class="p-8 text-center text-lg"> |
||||
{{ $t('setup.messageWelcome.whatIs') }} |
{{ $t('setup.messageSetupCreateAdminUser') }} |
||||
</p> |
</p> |
||||
<NuxtLink to="/setup/4"><BaseButton>Continue</BaseButton></NuxtLink> |
<form id="newAccount"></form> |
||||
|
<div> |
||||
|
<Label for="username">{{ $t('username') }}</Label> |
||||
|
<input |
||||
|
id="username" |
||||
|
v-model="username" |
||||
|
form="newAccount" |
||||
|
type="text" |
||||
|
autocomplete="username" |
||||
|
class="mb-5 w-full rounded-lg border-2 border-gray-100 px-3 py-2 text-sm text-gray-500 focus:border-red-800 focus:outline-0 focus:ring-0 dark:border-neutral-800 dark:bg-neutral-700 dark:text-gray-200 dark:placeholder:text-neutral-400 dark:focus:border-red-800" |
||||
|
/> |
||||
|
</div> |
||||
|
<div> |
||||
|
<Label for="password">{{ $t('setup.newPassword') }}</Label> |
||||
|
<input |
||||
|
id="password" |
||||
|
v-model="password" |
||||
|
form="newAccount" |
||||
|
type="password" |
||||
|
autocomplete="new-password" |
||||
|
class="mb-5 w-full rounded-lg border-2 border-gray-100 px-3 py-2 text-sm text-gray-500 focus:border-red-800 focus:outline-0 focus:ring-0 dark:border-neutral-800 dark:bg-neutral-700 dark:text-gray-200 dark:placeholder:text-neutral-400 dark:focus:border-red-800" |
||||
|
/> |
||||
|
</div> |
||||
|
<div> |
||||
|
<Label for="accept">{{ $t('setup.accept') }}</Label> |
||||
|
<input |
||||
|
id="accept" |
||||
|
v-model="accept" |
||||
|
form="newAccount" |
||||
|
type="checkbox" |
||||
|
class="ml-2" |
||||
|
/> |
||||
|
</div> |
||||
|
<BaseButton @click="newAccount">Create Account</BaseButton> |
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script lang="ts" setup> |
||||
|
import { FetchError } from 'ofetch'; |
||||
|
const { t } = useI18n(); |
||||
|
|
||||
definePageMeta({ |
definePageMeta({ |
||||
layout: 'setup', |
layout: 'setup', |
||||
}); |
}); |
||||
|
|
||||
const setupStore = useSetupStore(); |
const setupStore = useSetupStore(); |
||||
setupStore.setStep(3); |
setupStore.setStep(3); |
||||
|
const router = useRouter(); |
||||
|
const username = ref<null | string>(null); |
||||
|
const password = ref<null | string>(null); |
||||
|
const accept = ref<boolean>(true); |
||||
|
|
||||
|
const toast = useToast(); |
||||
|
|
||||
|
async function newAccount() { |
||||
|
try { |
||||
|
if (!username.value || !password.value) { |
||||
|
toast.showToast({ |
||||
|
type: 'error', |
||||
|
title: t('setup.requirements'), |
||||
|
message: t('setup.emptyFields'), |
||||
|
}); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
await setupStore.step3(username.value, password.value, accept.value); |
||||
|
await router.push('/setup/4'); |
||||
|
} catch (error) { |
||||
|
if (error instanceof FetchError) { |
||||
|
toast.showToast({ |
||||
|
type: 'error', |
||||
|
title: t('setup.requirements'), |
||||
|
message: error.data.message, |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
</script> |
</script> |
||||
|
@ -1,83 +1,19 @@ |
|||||
<template> |
<template> |
||||
<div> |
<div> |
||||
<p class="p-8 text-center text-lg"> |
<p class="p-8 text-center text-lg"> |
||||
{{ $t('setup.messageSetupCreateAdminUser') }} |
{{ 'Do you have a existing Setup?' }} |
||||
</p> |
</p> |
||||
<form id="newAccount"></form> |
<div class="mb-8 flex justify-center"> |
||||
<div> |
<NuxtLink to="/setup/5"><BaseButton>No</BaseButton></NuxtLink> |
||||
<Label for="username">{{ $t('username') }}</Label> |
<NuxtLink to="/setup/migrate"><BaseButton>Yes</BaseButton></NuxtLink> |
||||
<input |
|
||||
id="username" |
|
||||
v-model="username" |
|
||||
form="newAccount" |
|
||||
type="text" |
|
||||
autocomplete="username" |
|
||||
class="mb-5 w-full rounded-lg border-2 border-gray-100 px-3 py-2 text-sm text-gray-500 focus:border-red-800 focus:outline-0 focus:ring-0 dark:border-neutral-800 dark:bg-neutral-700 dark:text-gray-200 dark:placeholder:text-neutral-400 dark:focus:border-red-800" |
|
||||
/> |
|
||||
</div> |
</div> |
||||
<div> |
|
||||
<Label for="password">{{ $t('setup.newPassword') }}</Label> |
|
||||
<input |
|
||||
id="password" |
|
||||
v-model="password" |
|
||||
form="newAccount" |
|
||||
type="password" |
|
||||
autocomplete="new-password" |
|
||||
class="mb-5 w-full rounded-lg border-2 border-gray-100 px-3 py-2 text-sm text-gray-500 focus:border-red-800 focus:outline-0 focus:ring-0 dark:border-neutral-800 dark:bg-neutral-700 dark:text-gray-200 dark:placeholder:text-neutral-400 dark:focus:border-red-800" |
|
||||
/> |
|
||||
</div> |
|
||||
<div> |
|
||||
<Label for="accept">{{ $t('setup.accept') }}</Label> |
|
||||
<input |
|
||||
id="accept" |
|
||||
v-model="accept" |
|
||||
form="newAccount" |
|
||||
type="checkbox" |
|
||||
class="ml-2" |
|
||||
/> |
|
||||
</div> |
|
||||
<BaseButton @click="newAccount">Create Account</BaseButton> |
|
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||
import { FetchError } from 'ofetch'; |
|
||||
const { t } = useI18n(); |
|
||||
|
|
||||
definePageMeta({ |
definePageMeta({ |
||||
layout: 'setup', |
layout: 'setup', |
||||
}); |
}); |
||||
|
|
||||
const setupStore = useSetupStore(); |
const setupStore = useSetupStore(); |
||||
setupStore.setStep(4); |
setupStore.setStep(4); |
||||
const router = useRouter(); |
|
||||
const username = ref<null | string>(null); |
|
||||
const password = ref<null | string>(null); |
|
||||
const accept = ref<boolean>(true); |
|
||||
|
|
||||
const toast = useToast(); |
|
||||
|
|
||||
async function newAccount() { |
|
||||
try { |
|
||||
if (!username.value || !password.value) { |
|
||||
toast.showToast({ |
|
||||
type: 'error', |
|
||||
title: t('setup.requirements'), |
|
||||
message: t('setup.emptyFields'), |
|
||||
}); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
await setupStore.step4(username.value, password.value, accept.value); |
|
||||
await router.push('/setup/5'); |
|
||||
} catch (error) { |
|
||||
if (error instanceof FetchError) { |
|
||||
toast.showToast({ |
|
||||
type: 'error', |
|
||||
title: t('setup.requirements'), |
|
||||
message: error.data.message, |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</script> |
</script> |
||||
|
Loading…
Reference in new issue