mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
Merge pull request #3147 from Kuchenpirat/feat--send-reset-email-from-admin-dashboard
feat: email password reset link directly from admin dashboard
This commit is contained in:
commit
30ec65f43c
@ -16,6 +16,7 @@ env:
|
||||
SMTP_FROM_NAME: MealieDev
|
||||
SMTP_FROM_EMAIL: mealie@example.com
|
||||
SMTP_AUTH_STRATEGY: NONE
|
||||
BASE_URL: http://localhost:3000
|
||||
LANG: en-US
|
||||
|
||||
# loads .env file if it exists
|
||||
|
@ -38,9 +38,15 @@
|
||||
{{ resetUrl }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
<v-card-actions class="align-center" style="gap: 4px">
|
||||
<v-card-actions class="align-center pt-0" style="gap: 4px">
|
||||
<BaseButton cancel @click="resetUrl = ''"> {{ $t("general.close") }} </BaseButton>
|
||||
<v-spacer></v-spacer>
|
||||
<BaseButton v-if="user.email" color="info" class="mr-1" @click="sendResetEmail">
|
||||
<template #icon>
|
||||
{{ $globals.icons.email }}
|
||||
</template>
|
||||
{{ $t("user.email") }}
|
||||
</BaseButton>
|
||||
<AppButtonCopy :icon="false" color="info" :copy-text="resetUrl" />
|
||||
</v-card-actions>
|
||||
</div>
|
||||
@ -57,7 +63,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, useRoute, onMounted, ref, useContext } from "@nuxtjs/composition-api";
|
||||
import { useAdminApi } from "~/composables/api";
|
||||
import { useAdminApi, useUserApi } from "~/composables/api";
|
||||
import { useGroups } from "~/composables/use-groups";
|
||||
import { alert } from "~/composables/use-toast";
|
||||
import { useUserForm } from "~/composables/use-users";
|
||||
@ -129,6 +135,17 @@ export default defineComponent({
|
||||
generatingToken.value = false;
|
||||
}
|
||||
|
||||
const userApi = useUserApi();
|
||||
async function sendResetEmail() {
|
||||
if (!user.value?.email) return;
|
||||
const { response } = await userApi.email.sendForgotPassword({ email: user.value.email });
|
||||
if (response && response.status === 200) {
|
||||
alert.success(i18n.tc("profile.email-sent"));
|
||||
} else {
|
||||
alert.error(i18n.tc("profile.error-sending-email"));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
user,
|
||||
disabledFields,
|
||||
@ -141,6 +158,7 @@ export default defineComponent({
|
||||
handlePasswordReset,
|
||||
resetUrl,
|
||||
generatingToken,
|
||||
sendResetEmail,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user