mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
new user card
This commit is contained in:
parent
ad71ab6603
commit
63ebb6c5bb
10 changed files with 269 additions and 249 deletions
9
Caddyfile.dev
Normal file
9
Caddyfile.dev
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
admin off
|
||||||
|
}
|
||||||
|
|
||||||
|
localhost {
|
||||||
|
handle /mealie/* {
|
||||||
|
reverse_proxy http://127.0.0.1:9090
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,39 +1,30 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mt-n5" v-if="recipes">
|
<div v-if="recipes">
|
||||||
<v-card flat class="transparent" height="60px">
|
<v-app-bar color="transparent" flat class="mt-n1 rounded" v-if="!disableToolbar">
|
||||||
<v-card-text>
|
<v-icon large left v-if="title">
|
||||||
<v-row v-if="title != null">
|
{{ titleIcon }}
|
||||||
<v-col>
|
</v-icon>
|
||||||
<v-btn-toggle group>
|
<v-toolbar-title class="headline"> {{ title }} </v-toolbar-title>
|
||||||
<v-btn text>
|
<v-spacer></v-spacer>
|
||||||
{{ title.toUpperCase() }}
|
<v-menu offset-y v-if="$listeners.sortRecent || $listeners.sort">
|
||||||
</v-btn>
|
<template v-slot:activator="{ on, attrs }">
|
||||||
</v-btn-toggle>
|
<v-btn-toggle group>
|
||||||
</v-col>
|
<v-btn text v-bind="attrs" v-on="on">
|
||||||
<v-spacer></v-spacer>
|
{{ $t("general.sort") }}
|
||||||
<v-col align="end">
|
</v-btn>
|
||||||
<v-menu offset-y v-if="sortable">
|
</v-btn-toggle>
|
||||||
<template v-slot:activator="{ on, attrs }">
|
</template>
|
||||||
<v-btn-toggle group>
|
<v-list>
|
||||||
<v-btn text v-bind="attrs" v-on="on">
|
<v-list-item @click="$emit('sortRecent')">
|
||||||
{{ $t("general.sort") }}
|
<v-list-item-title>{{ $t("general.recent") }}</v-list-item-title>
|
||||||
</v-btn>
|
</v-list-item>
|
||||||
</v-btn-toggle>
|
<v-list-item @click="$emit('sort')">
|
||||||
</template>
|
<v-list-item-title>{{ $t("general.sort-alphabetically") }}</v-list-item-title>
|
||||||
<v-list>
|
</v-list-item>
|
||||||
<v-list-item @click="$emit('sort-recent')">
|
</v-list>
|
||||||
<v-list-item-title>{{ $t("general.recent") }}</v-list-item-title>
|
</v-menu>
|
||||||
</v-list-item>
|
</v-app-bar>
|
||||||
<v-list-item @click="$emit('sort')">
|
<div v-if="recipes" class="mt-2">
|
||||||
<v-list-item-title>{{ $t("general.sort-alphabetically") }}</v-list-item-title>
|
|
||||||
</v-list-item>
|
|
||||||
</v-list>
|
|
||||||
</v-menu>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card-text>
|
|
||||||
</v-card>
|
|
||||||
<div v-if="recipes">
|
|
||||||
<v-row v-if="!viewScale">
|
<v-row v-if="!viewScale">
|
||||||
<v-col :sm="6" :md="6" :lg="4" :xl="3" v-for="recipe in recipes.slice(0, cardLimit)" :key="recipe.name">
|
<v-col :sm="6" :md="6" :lg="4" :xl="3" v-for="recipe in recipes.slice(0, cardLimit)" :key="recipe.name">
|
||||||
<RecipeCard
|
<RecipeCard
|
||||||
|
@ -91,9 +82,12 @@ export default {
|
||||||
MobileRecipeCard,
|
MobileRecipeCard,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
sortable: {
|
disableToolbar: {
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
titleIcon: {
|
||||||
|
default: "mdi-tag-multiple-outline",
|
||||||
|
},
|
||||||
title: {
|
title: {
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
w<template>
|
w<template>
|
||||||
<v-card v-bind="$attrs" :class="classes" class="v-card--material pa-3">
|
<v-card v-bind="$attrs" :class="classes" class="v-card--material pa-3">
|
||||||
<div class="d-flex grow flex-wrap">
|
<div class="d-flex grow flex-wrap">
|
||||||
<v-sheet
|
<slot name="avatar">
|
||||||
:color="color"
|
<v-sheet
|
||||||
:max-height="icon ? 90 : undefined"
|
:color="color"
|
||||||
:width="icon ? 'auto' : '100%'"
|
:max-height="icon ? 90 : undefined"
|
||||||
elevation="6"
|
:width="icon ? 'auto' : '100%'"
|
||||||
class="text-start v-card--material__heading mb-n6 mt-n10 pa-7"
|
elevation="6"
|
||||||
dark
|
class="text-start v-card--material__heading mb-n6 mt-n10 pa-7"
|
||||||
>
|
dark
|
||||||
<v-icon v-if="icon" size="40" v-text="icon" />
|
>
|
||||||
<div v-if="text" class="headline font-weight-thin" v-text="text" />
|
<v-icon v-if="icon" size="40" v-text="icon" />
|
||||||
</v-sheet>
|
<div v-if="text" class="headline font-weight-thin" v-text="text" />
|
||||||
|
</v-sheet>
|
||||||
|
</slot>
|
||||||
|
|
||||||
<div v-if="$slots['after-heading']" class="ml-auto">
|
<div v-if="$slots['after-heading']" class="ml-auto">
|
||||||
<slot name="after-heading" />
|
<slot name="after-heading" />
|
||||||
|
@ -21,7 +23,7 @@ w<template>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<template v-if="$slots.actions">
|
<template v-if="$slots.actions">
|
||||||
<v-divider class="mt-2" />
|
<v-divider class="mt-2" v-if="!$slots.bottom" />
|
||||||
|
|
||||||
<v-card-actions class="pb-0">
|
<v-card-actions class="pb-0">
|
||||||
<slot name="actions" />
|
<slot name="actions" />
|
||||||
|
@ -29,7 +31,7 @@ w<template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="$slots.bottom">
|
<template v-if="$slots.bottom">
|
||||||
<v-divider class="mt-2" />
|
<v-divider class="mt-2" v-if="!$slots.actions" />
|
||||||
|
|
||||||
<div class="pb-0">
|
<div class="pb-0">
|
||||||
<slot name="bottom" />
|
<slot name="bottom" />
|
|
@ -67,7 +67,7 @@
|
||||||
import TheUploadBtn from "@/components/UI/Buttons/TheUploadBtn";
|
import TheUploadBtn from "@/components/UI/Buttons/TheUploadBtn";
|
||||||
import ImportSummaryDialog from "@/components/ImportSummaryDialog";
|
import ImportSummaryDialog from "@/components/ImportSummaryDialog";
|
||||||
import { api } from "@/api";
|
import { api } from "@/api";
|
||||||
import StatCard from "./StatCard";
|
import StatCard from "@/components/UI/StatCard";
|
||||||
import BackupDialog from "@/components/UI/Dialogs/BackupDialog";
|
import BackupDialog from "@/components/UI/Dialogs/BackupDialog";
|
||||||
import ImportDialog from "@/components/UI/Dialogs/ImportDialog";
|
import ImportDialog from "@/components/UI/Dialogs/ImportDialog";
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { api } from "@/api";
|
import { api } from "@/api";
|
||||||
import StatCard from "./StatCard";
|
import StatCard from "@/components/UI/StatCard";
|
||||||
export default {
|
export default {
|
||||||
components: { StatCard },
|
components: { StatCard },
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { api } from "@/api";
|
import { api } from "@/api";
|
||||||
import StatCard from "./StatCard";
|
import StatCard from "@/components/UI/StatCard";
|
||||||
import EventViewer from "./EventViewer";
|
import EventViewer from "./EventViewer";
|
||||||
import BackupViewer from "./BackupViewer";
|
import BackupViewer from "./BackupViewer";
|
||||||
export default {
|
export default {
|
||||||
|
|
205
frontend/src/pages/Admin/Profile/UserCard.vue
Normal file
205
frontend/src/pages/Admin/Profile/UserCard.vue
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
<template>
|
||||||
|
<div class="mt-10">
|
||||||
|
<v-row>
|
||||||
|
<v-col cols="12" sm="12" md="6">
|
||||||
|
<StatCard icon="mdi-account">
|
||||||
|
<template v-slot:avatar>
|
||||||
|
<v-avatar color="accent" size="120" class="white--text headline mt-n12">
|
||||||
|
<img :src="userProfileImage" v-if="!hideImage" @error="hideImage = true" />
|
||||||
|
<div v-else>
|
||||||
|
{{ initials }}
|
||||||
|
</div>
|
||||||
|
</v-avatar>
|
||||||
|
</template>
|
||||||
|
<template v-slot:after-heading>
|
||||||
|
<div class="ml-auto text-right">
|
||||||
|
<div
|
||||||
|
class="body-3 grey--text font-weight-light"
|
||||||
|
v-text="$t('user.user-id-with-value', { id: user.id })"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h3 class="display-2 font-weight-light text--primary">
|
||||||
|
<small> {{ $t("group.group") }}: {{ user.group }} </small>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:actions>
|
||||||
|
<TheUploadBtn
|
||||||
|
icon="mdi-image-area"
|
||||||
|
:text="$t('user.upload-photo')"
|
||||||
|
:url="userProfileImage"
|
||||||
|
file-name="profile_image"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
|
||||||
|
<BaseDialog
|
||||||
|
:title="$t('user.reset-password')"
|
||||||
|
title-icon="mdi-lock"
|
||||||
|
:submit-text="$t('settings.change-password')"
|
||||||
|
@submit="changePassword"
|
||||||
|
:loading="loading"
|
||||||
|
:top="true"
|
||||||
|
>
|
||||||
|
<template v-slot:open="{ open }">
|
||||||
|
<v-btn color="primary" class="mr-1" small @click="open">
|
||||||
|
<v-icon left>mdi-lock</v-icon>
|
||||||
|
Change Password
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<v-card-text>
|
||||||
|
<v-form ref="passChange">
|
||||||
|
<v-text-field
|
||||||
|
v-model="password.current"
|
||||||
|
prepend-icon="mdi-lock"
|
||||||
|
:label="$t('user.current-password')"
|
||||||
|
:rules="[existsRule]"
|
||||||
|
validate-on-blur
|
||||||
|
:type="showPassword ? 'text' : 'password'"
|
||||||
|
@click:append="showPassword.current = !showPassword.current"
|
||||||
|
></v-text-field>
|
||||||
|
<v-text-field
|
||||||
|
v-model="password.newOne"
|
||||||
|
prepend-icon="mdi-lock"
|
||||||
|
:label="$t('user.new-password')"
|
||||||
|
:rules="[minRule]"
|
||||||
|
:type="showPassword ? 'text' : 'password'"
|
||||||
|
@click:append="showPassword.newOne = !showPassword.newOne"
|
||||||
|
></v-text-field>
|
||||||
|
<v-text-field
|
||||||
|
v-model="password.newTwo"
|
||||||
|
prepend-icon="mdi-lock"
|
||||||
|
:label="$t('user.confirm-password')"
|
||||||
|
:rules="[password.newOne === password.newTwo || $t('user.password-must-match')]"
|
||||||
|
validate-on-blur
|
||||||
|
:type="showPassword ? 'text' : 'password'"
|
||||||
|
@click:append="showPassword.newTwo = !showPassword.newTwo"
|
||||||
|
></v-text-field>
|
||||||
|
</v-form>
|
||||||
|
</v-card-text>
|
||||||
|
</BaseDialog>
|
||||||
|
|
||||||
|
<v-btn color="success" small class="mr-2" @click="updateUser">
|
||||||
|
<v-icon left> mdi-content-save </v-icon>
|
||||||
|
{{ $t("general.update") }}
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<template v-slot:bottom>
|
||||||
|
<v-card-text>
|
||||||
|
<v-form>
|
||||||
|
<v-text-field
|
||||||
|
:label="$t('user.full-name')"
|
||||||
|
required
|
||||||
|
v-model="user.fullName"
|
||||||
|
:rules="[existsRule]"
|
||||||
|
validate-on-blur
|
||||||
|
>
|
||||||
|
</v-text-field>
|
||||||
|
<v-text-field
|
||||||
|
:label="$t('user.email')"
|
||||||
|
:rules="[emailRule]"
|
||||||
|
validate-on-blur
|
||||||
|
required
|
||||||
|
v-model="user.email"
|
||||||
|
>
|
||||||
|
</v-text-field>
|
||||||
|
</v-form>
|
||||||
|
</v-card-text>
|
||||||
|
</template>
|
||||||
|
</StatCard>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="12" md="6"> </v-col>
|
||||||
|
</v-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseDialog from "@/components/UI/Dialogs/BaseDialog";
|
||||||
|
import StatCard from "@/components/UI/StatCard";
|
||||||
|
import TheUploadBtn from "@/components/UI/Buttons/TheUploadBtn";
|
||||||
|
import { api } from "@/api";
|
||||||
|
import { validators } from "@/mixins/validators";
|
||||||
|
import { initials } from "@/mixins/initials";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
BaseDialog,
|
||||||
|
TheUploadBtn,
|
||||||
|
StatCard,
|
||||||
|
},
|
||||||
|
mixins: [validators, initials],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
hideImage: false,
|
||||||
|
passwordLoading: false,
|
||||||
|
password: {
|
||||||
|
current: "",
|
||||||
|
newOne: "",
|
||||||
|
newTwo: "",
|
||||||
|
},
|
||||||
|
showPassword: false,
|
||||||
|
loading: false,
|
||||||
|
user: {
|
||||||
|
fullName: "",
|
||||||
|
email: "",
|
||||||
|
group: "",
|
||||||
|
admin: false,
|
||||||
|
id: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
userProfileImage() {
|
||||||
|
this.resetImage();
|
||||||
|
return `api/users/${this.user.id}/image`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
async mounted() {
|
||||||
|
this.refreshProfile();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
resetImage() {
|
||||||
|
this.hideImage = false;
|
||||||
|
},
|
||||||
|
async refreshProfile() {
|
||||||
|
this.user = await api.users.self();
|
||||||
|
},
|
||||||
|
openAvatarPicker() {
|
||||||
|
this.showAvatarPicker = true;
|
||||||
|
},
|
||||||
|
selectAvatar(avatar) {
|
||||||
|
this.user.avatar = avatar;
|
||||||
|
},
|
||||||
|
async updateUser() {
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
const response = await api.users.update(this.user);
|
||||||
|
if (response) {
|
||||||
|
this.$store.commit("setToken", response.data.access_token);
|
||||||
|
this.refreshProfile();
|
||||||
|
this.loading = false;
|
||||||
|
this.$store.dispatch("requestUserData");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async changePassword() {
|
||||||
|
this.paswordLoading = true;
|
||||||
|
let data = {
|
||||||
|
currentPassword: this.password.current,
|
||||||
|
newPassword: this.password.newOne,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.$refs.passChange.validate()) {
|
||||||
|
if (await api.users.changePassword(this.user.id, data)) {
|
||||||
|
this.$emit("refresh");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.paswordLoading = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
|
@ -1,206 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<v-row dense>
|
<div class="mt-10">
|
||||||
<v-col cols="12" md="8" sm="12">
|
<UserCard />
|
||||||
<v-card>
|
</div>
|
||||||
<v-card-title class="headline">
|
|
||||||
<span>
|
|
||||||
<v-progress-circular v-if="loading" indeterminate color="primary" large class="mr-2"> </v-progress-circular>
|
|
||||||
</span>
|
|
||||||
{{ $t("settings.profile") }}
|
|
||||||
<v-spacer></v-spacer>
|
|
||||||
{{ $t("user.user-id-with-value", { id: user.id }) }}
|
|
||||||
</v-card-title>
|
|
||||||
<v-divider></v-divider>
|
|
||||||
<v-card-text>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12" md="3" align="center" justify="center">
|
|
||||||
<v-avatar color="accent" size="120" class="white--text headline mr-2">
|
|
||||||
<img :src="userProfileImage" v-if="!hideImage" @error="hideImage = true" />
|
|
||||||
<div v-else>
|
|
||||||
{{ initials }}
|
|
||||||
</div>
|
|
||||||
</v-avatar>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" md="9">
|
|
||||||
<v-form>
|
|
||||||
<v-text-field
|
|
||||||
:label="$t('user.full-name')"
|
|
||||||
required
|
|
||||||
v-model="user.fullName"
|
|
||||||
:rules="[existsRule]"
|
|
||||||
validate-on-blur
|
|
||||||
>
|
|
||||||
</v-text-field>
|
|
||||||
<v-text-field
|
|
||||||
:label="$t('user.email')"
|
|
||||||
:rules="[emailRule]"
|
|
||||||
validate-on-blur
|
|
||||||
required
|
|
||||||
v-model="user.email"
|
|
||||||
>
|
|
||||||
</v-text-field>
|
|
||||||
<v-text-field
|
|
||||||
:label="$t('group.group')"
|
|
||||||
readonly
|
|
||||||
v-model="user.group"
|
|
||||||
persistent-hint
|
|
||||||
:hint="$t('group.groups-can-only-be-set-by-administrators')"
|
|
||||||
>
|
|
||||||
</v-text-field>
|
|
||||||
</v-form>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card-text>
|
|
||||||
|
|
||||||
<v-card-actions>
|
|
||||||
<TheUploadBtn
|
|
||||||
icon="mdi-image-area"
|
|
||||||
:text="$t('user.upload-photo')"
|
|
||||||
:url="userProfileImage"
|
|
||||||
file-name="profile_image"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-spacer></v-spacer>
|
|
||||||
<v-btn color="success" class="mr-2" @click="updateUser">
|
|
||||||
<v-icon left> mdi-content-save </v-icon>
|
|
||||||
{{ $t("general.save") }}
|
|
||||||
</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
<v-col cols="12" md="4" sm="12">
|
|
||||||
<v-card height="100%">
|
|
||||||
<v-card-title class="headline">
|
|
||||||
{{ $t("user.reset-password") }}
|
|
||||||
<v-spacer></v-spacer>
|
|
||||||
</v-card-title>
|
|
||||||
<v-divider></v-divider>
|
|
||||||
<v-card-text>
|
|
||||||
<v-form ref="passChange">
|
|
||||||
<v-text-field
|
|
||||||
v-model="password.current"
|
|
||||||
prepend-icon="mdi-lock"
|
|
||||||
:label="$t('user.current-password')"
|
|
||||||
:rules="[existsRule]"
|
|
||||||
validate-on-blur
|
|
||||||
:type="showPassword ? 'text' : 'password'"
|
|
||||||
@click:append="showPassword.current = !showPassword.current"
|
|
||||||
></v-text-field>
|
|
||||||
<v-text-field
|
|
||||||
v-model="password.newOne"
|
|
||||||
prepend-icon="mdi-lock"
|
|
||||||
:label="$t('user.new-password')"
|
|
||||||
:rules="[minRule]"
|
|
||||||
:type="showPassword ? 'text' : 'password'"
|
|
||||||
@click:append="showPassword.newOne = !showPassword.newOne"
|
|
||||||
></v-text-field>
|
|
||||||
<v-text-field
|
|
||||||
v-model="password.newTwo"
|
|
||||||
prepend-icon="mdi-lock"
|
|
||||||
:label="$t('user.confirm-password')"
|
|
||||||
:rules="[password.newOne === password.newTwo || $t('user.password-must-match')]"
|
|
||||||
validate-on-blur
|
|
||||||
:type="showPassword ? 'text' : 'password'"
|
|
||||||
@click:append="showPassword.newTwo = !showPassword.newTwo"
|
|
||||||
></v-text-field>
|
|
||||||
</v-form>
|
|
||||||
</v-card-text>
|
|
||||||
<v-card-actions>
|
|
||||||
<v-btn icon @click="showPassword = !showPassword" :loading="passwordLoading">
|
|
||||||
<v-icon v-if="!showPassword">mdi-eye-off</v-icon>
|
|
||||||
<v-icon v-else> mdi-eye </v-icon>
|
|
||||||
</v-btn>
|
|
||||||
<v-spacer></v-spacer>
|
|
||||||
<v-btn color="accent" class="mr-2" @click="changePassword">
|
|
||||||
<v-icon left> mdi-lock </v-icon>
|
|
||||||
{{ $t("settings.change-password") }}
|
|
||||||
</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import AvatarPicker from '@/components/AvatarPicker'
|
import UserCard from "./UserCard";
|
||||||
import TheUploadBtn from "@/components/UI/Buttons/TheUploadBtn";
|
|
||||||
import { api } from "@/api";
|
|
||||||
import { validators } from "@/mixins/validators";
|
|
||||||
import { initials } from "@/mixins/initials";
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
TheUploadBtn,
|
UserCard,
|
||||||
},
|
|
||||||
mixins: [validators, initials],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hideImage: false,
|
|
||||||
passwordLoading: false,
|
|
||||||
password: {
|
|
||||||
current: "",
|
|
||||||
newOne: "",
|
|
||||||
newTwo: "",
|
|
||||||
},
|
|
||||||
showPassword: false,
|
|
||||||
loading: false,
|
|
||||||
user: {
|
|
||||||
fullName: "",
|
|
||||||
email: "",
|
|
||||||
group: "",
|
|
||||||
admin: false,
|
|
||||||
id: 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
userProfileImage() {
|
|
||||||
this.resetImage();
|
|
||||||
return `api/users/${this.user.id}/image`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
async mounted() {
|
|
||||||
this.refreshProfile();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
resetImage() {
|
|
||||||
this.hideImage = false;
|
|
||||||
},
|
|
||||||
async refreshProfile() {
|
|
||||||
this.user = await api.users.self();
|
|
||||||
},
|
|
||||||
openAvatarPicker() {
|
|
||||||
this.showAvatarPicker = true;
|
|
||||||
},
|
|
||||||
selectAvatar(avatar) {
|
|
||||||
this.user.avatar = avatar;
|
|
||||||
},
|
|
||||||
async updateUser() {
|
|
||||||
this.loading = true;
|
|
||||||
const response = await api.users.update(this.user);
|
|
||||||
if (response) {
|
|
||||||
this.$store.commit("setToken", response.data.access_token);
|
|
||||||
this.refreshProfile();
|
|
||||||
this.loading = false;
|
|
||||||
this.$store.dispatch("requestUserData");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async changePassword() {
|
|
||||||
this.paswordLoading = true;
|
|
||||||
let data = {
|
|
||||||
currentPassword: this.password.current,
|
|
||||||
newPassword: this.password.newOne,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.$refs.passChange.validate()) {
|
|
||||||
if (await api.users.changePassword(this.user.id, data)) {
|
|
||||||
this.$emit("refresh");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.paswordLoading = false;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<v-container>
|
<v-container>
|
||||||
<CardSection
|
<CardSection
|
||||||
|
title-icon=""
|
||||||
v-if="siteSettings.showRecent"
|
v-if="siteSettings.showRecent"
|
||||||
:title="$t('page.recent')"
|
:title="$t('page.recent')"
|
||||||
:recipes="recentRecipes"
|
:recipes="recentRecipes"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<v-container>
|
<v-container>
|
||||||
<v-progress-linear v-if="loading" indeterminate color="primary"></v-progress-linear>
|
<v-progress-linear v-if="loading" indeterminate color="primary"></v-progress-linear>
|
||||||
<CardSection
|
<CardSection
|
||||||
|
title-icon=""
|
||||||
:sortable="true"
|
:sortable="true"
|
||||||
:title="$t('page.all-recipes')"
|
:title="$t('page.all-recipes')"
|
||||||
:recipes="allRecipes"
|
:recipes="allRecipes"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue