fix: validate current password with a modal (#5805)
This commit is contained in:
58
frontend/src/components/prompts/CurrentPassword.vue
Normal file
58
frontend/src/components/prompts/CurrentPassword.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="card floating">
|
||||
<div class="card-title">
|
||||
<h2>{{ $t("prompts.currentPassword") }}</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<p>
|
||||
{{ $t("prompts.currentPasswordMessage") }}
|
||||
</p>
|
||||
<input
|
||||
id="focus-prompt"
|
||||
class="input input--block"
|
||||
type="text"
|
||||
@keyup.enter="submit"
|
||||
v-model="password"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="card-action">
|
||||
<button
|
||||
class="button button--flat button--grey"
|
||||
@click="cancel"
|
||||
:aria-label="$t('buttons.cancel')"
|
||||
:title="$t('buttons.cancel')"
|
||||
>
|
||||
{{ $t("buttons.cancel") }}
|
||||
</button>
|
||||
<button
|
||||
@click="submit"
|
||||
class="button button--flat"
|
||||
type="submit"
|
||||
:aria-label="$t('buttons.ok')"
|
||||
:title="$t('buttons.ok')"
|
||||
>
|
||||
{{ $t("buttons.ok") }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { useLayoutStore } from "@/stores/layout";
|
||||
const layoutStore = useLayoutStore();
|
||||
|
||||
const { currentPrompt } = layoutStore;
|
||||
|
||||
const password = ref("");
|
||||
|
||||
const submit = (event: Event) => {
|
||||
currentPrompt?.confirm(event, password.value);
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
layoutStore.closeHovers();
|
||||
};
|
||||
</script>
|
||||
@@ -28,6 +28,7 @@ import ShareDelete from "./ShareDelete.vue";
|
||||
import Upload from "./Upload.vue";
|
||||
import DiscardEditorChanges from "./DiscardEditorChanges.vue";
|
||||
import ResolveConflict from "./ResolveConflict.vue";
|
||||
import CurrentPassword from "./CurrentPassword.vue";
|
||||
|
||||
const layoutStore = useLayoutStore();
|
||||
|
||||
@@ -50,6 +51,7 @@ const components = new Map<string, any>([
|
||||
["deleteUser", DeleteUser],
|
||||
["discardEditorChanges", DiscardEditorChanges],
|
||||
["resolve-conflict", ResolveConflict],
|
||||
["current-password", CurrentPassword],
|
||||
]);
|
||||
|
||||
const modal = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user