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

feat: First Time Setup Wizard #3204

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0b5dcf6
extract user registration form into a composable
michael-genson Feb 19, 2024
b5fbee9
added base wizard component
michael-genson Feb 19, 2024
8e80a65
added partial setup implementation
michael-genson Feb 19, 2024
cf23b79
removed unused attrs
michael-genson Feb 19, 2024
8ea0a97
added setup bypass
michael-genson Feb 19, 2024
da100d1
made setup page more readable
michael-genson Feb 19, 2024
3698b83
add checkbox hints to autoform
michael-genson Feb 19, 2024
f89cee2
added common settings pages and initial submit logic
michael-genson Feb 19, 2024
85f0ca5
bypass setup in demo
michael-genson Feb 20, 2024
138a0a0
add full name to user registration
michael-genson Feb 20, 2024
8c77f4e
added fullname and pw handling to setup
michael-genson Feb 20, 2024
c9d8179
fixed wizard indentation
michael-genson Feb 20, 2024
e9c7c28
added post-setup suggestions
michael-genson Feb 20, 2024
654dd99
added tests for backend changes
michael-genson Feb 20, 2024
53f8e7d
Merge branch 'mealie-next' into feat/first-time-setup
michael-genson Feb 20, 2024
99e9b75
renamed Wizard to BaseWizard
michael-genson Feb 20, 2024
cea4253
lint fixes
michael-genson Feb 20, 2024
84e1234
Merge branch 'mealie-next' into feat/first-time-setup
michael-genson Feb 23, 2024
835ccf6
Merge branch 'mealie-next' into feat/first-time-setup
michael-genson Mar 5, 2024
77cced4
Merge remote-tracking branch 'upstream/mealie-next' into feat/first-t…
michael-genson Mar 10, 2024
6256a7a
pass hardcoded default password instead of backend nonsense
michael-genson Mar 10, 2024
84fd414
removed old test
michael-genson Mar 10, 2024
de349a1
fix e2e
michael-genson Mar 10, 2024
0e6b123
added setup skip to e2e testing for all admin users
michael-genson Mar 10, 2024
a597e4b
Merge branch 'mealie-next' into feat/first-time-setup
hay-kot Mar 11, 2024
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
160 changes: 160 additions & 0 deletions frontend/components/Domain/User/UserRegistrationForm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<template>
<div>
<v-card-title>
<v-icon large class="mr-3"> {{ $globals.icons.user }}</v-icon>
<span class="headline"> {{ $t("user-registration.account-details") }}</span>
</v-card-title>
<v-divider />
<v-card-text>
<v-form ref="domAccountForm" @submit.prevent>
<v-text-field
v-model="accountDetails.username.value"
autofocus
v-bind="inputAttrs"
:label="$tc('user.username')"
:prepend-icon="$globals.icons.user"
:rules="[validators.required]"
:error-messages="usernameErrorMessages"
@blur="validateUsername"
/>
<v-text-field
v-model="accountDetails.fullName.value"
v-bind="inputAttrs"
:label="$tc('user.full-name')"
:prepend-icon="$globals.icons.user"
:rules="[validators.required]"
/>
<v-text-field
v-model="accountDetails.email.value"
v-bind="inputAttrs"
:prepend-icon="$globals.icons.email"
:label="$tc('user.email')"
:rules="[validators.required, validators.email]"
:error-messages="emailErrorMessages"
@blur="validateEmail"
/>
<v-text-field
v-model="credentials.password1.value"
v-bind="inputAttrs"
:type="pwFields.inputType.value"
:append-icon="pwFields.passwordIcon.value"
:prepend-icon="$globals.icons.lock"
:label="$tc('user.password')"
:rules="[validators.required, validators.minLength(8), validators.maxLength(258)]"
@click:append="pwFields.togglePasswordShow"
/>

<UserPasswordStrength :value="credentials.password1.value" />

<v-text-field
v-model="credentials.password2.value"
v-bind="inputAttrs"
:type="pwFields.inputType.value"
:append-icon="pwFields.passwordIcon.value"
:prepend-icon="$globals.icons.lock"
:label="$tc('user.confirm-password')"
:rules="[validators.required, credentials.passwordMatch]"
@click:append="pwFields.togglePasswordShow"
/>
<div class="px-2">
<v-checkbox
v-model="accountDetails.advancedOptions.value"
:label="$tc('user.enable-advanced-content')"
/>
<p class="text-caption mt-n4">
{{ $tc("user.enable-advanced-content-description") }}
</p>
</div>
</v-form>
</v-card-text>
</div>
</template>

<script lang="ts">
import { defineComponent, ref } from "@nuxtjs/composition-api";
import { useDark } from "@vueuse/core";
import { validators } from "~/composables/use-validators";
import { useUserRegistrationForm } from "~/composables/use-users/user-registration-form";
import { usePasswordField } from "~/composables/use-passwords";
import UserPasswordStrength from "~/components/Domain/User/UserPasswordStrength.vue";

const inputAttrs = {
filled: true,
rounded: true,
validateOnBlur: true,
class: "rounded-lg",
};

export default defineComponent({
components: { UserPasswordStrength },
layout: "blank",
setup() {
const isDark = useDark();
const langDialog = ref(false);

const pwFields = usePasswordField();
const {
accountDetails,
credentials,
emailErrorMessages,
usernameErrorMessages,
validateUsername,
validateEmail,
domAccountForm,
} = useUserRegistrationForm();
return {
accountDetails,
credentials,
emailErrorMessages,
inputAttrs,
isDark,
langDialog,
pwFields,
usernameErrorMessages,
validators,
// Validators
validateUsername,
validateEmail,
// Dom Refs
domAccountForm,
};
},
});
</script>

<style lang="css" scoped>
.icon-primary {
fill: var(--v-primary-base);
}

.icon-white {
fill: white;
}

.icon-container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
position: relative;
margin-top: 2.5rem;
}

.icon-divider {
width: 100%;
margin-bottom: -2.5rem;
}

.icon-avatar {
border-color: rgba(0, 0, 0, 0.12);
border: 2px;
}

.bg-off-white {
background: #f5f8fa;
}

.preferred-width {
width: 840px;
}
</style>
16 changes: 13 additions & 3 deletions frontend/components/global/AutoForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@
v-if="inputField.type === fieldTypes.BOOLEAN"
v-model="value[inputField.varName]"
class="my-0 py-0"
:label="inputField.label"
:name="inputField.varName"
:hint="inputField.hint || ''"
:disabled="(inputField.disableUpdate && updateMode) || (!updateMode && inputField.disableCreate) || (disabledFields && disabledFields.includes(inputField.varName))"
@change="emitBlur"
/>
>
<template #label>
<div>
<v-card-text class="text-body-1 my-0 py-0">
{{ inputField.label }}
</v-card-text>
<v-card-text v-if="inputField.hint" class="text-caption my-0 py-0">
{{ inputField.hint }}
</v-card-text>
</div>
</template>
</v-checkbox>


<!-- Text Field -->
<v-text-field
Expand Down
Loading
Loading