feat: expose default password in auth props and display it in reset password dialogs
This commit is contained in:
parent
691916e6de
commit
d27ac7ed6f
@ -53,6 +53,7 @@ public function share(Request $request): array
|
||||
'roles' => $request->user()->getRoleNames(),
|
||||
'permissions' => $request->user()->getAllPermissions()->pluck('name'),
|
||||
] : null,
|
||||
'password_default' => config('auth.password_default'),
|
||||
],
|
||||
'flash' => [
|
||||
'success' => $request->session()->get('success'),
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { ref } from 'vue';
|
||||
import { router, usePage } from '@inertiajs/vue3';
|
||||
import { computed, ref } from 'vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import {
|
||||
AlertDialog,
|
||||
@ -20,6 +20,9 @@ const props = defineProps<{
|
||||
employeeName?: string | null;
|
||||
}>();
|
||||
|
||||
const page = usePage();
|
||||
const defaultPassword = page.props.auth.password_default as string;
|
||||
|
||||
const open = ref(false);
|
||||
const processing = ref(false);
|
||||
|
||||
@ -54,7 +57,7 @@ function resetPassword() {
|
||||
<AlertDialogDescription>
|
||||
Kata sandi
|
||||
<span class="text-foreground font-medium">{{ employeeName ?? 'pegawai' }}</span>
|
||||
akan direset ke kata sandi default sistem. Pengguna akan otomatis logout dari
|
||||
akan direset ke kata sandi default sistem (<span class="font-mono bg-muted px-1.5 py-0.5 rounded text-foreground font-medium">{{ defaultPassword }}</span>). Pengguna akan otomatis logout dari
|
||||
semua sesi aktif.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { Link, router } from '@inertiajs/vue3';
|
||||
import { Link, router, usePage } from '@inertiajs/vue3';
|
||||
import { KeyRound, Pencil, Trash2 } from '@lucide/vue';
|
||||
import { ref } from 'vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
@ -14,6 +14,8 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const { can } = useCan();
|
||||
const page = usePage();
|
||||
const defaultPassword = page.props.auth.password_default as string;
|
||||
|
||||
const deleteConfirmOpen = ref(false);
|
||||
const resetPasswordConfirmOpen = ref(false);
|
||||
@ -94,7 +96,7 @@ function resetPassword() {
|
||||
v-if="can('employees.reset-password')"
|
||||
v-model:open="resetPasswordConfirmOpen"
|
||||
title="Reset kata sandi pegawai?"
|
||||
:description="`Kata sandi ${employee.profile?.full_name ?? 'pegawai'} akan direset ke kata sandi default sistem. Pengguna akan otomatis logout dari semua sesi aktif.`"
|
||||
:description="`Kata sandi ${employee.profile?.full_name ?? 'pegawai'} akan direset ke kata sandi default sistem (${defaultPassword}). Pengguna akan otomatis logout dari semua sesi aktif.`"
|
||||
confirm-label="Reset Kata Sandi" cancel-label="Batal" :loading="resetPasswordProcessing"
|
||||
@confirm="resetPassword" />
|
||||
|
||||
|
||||
@ -11,4 +11,5 @@ export type User = {
|
||||
|
||||
export type Auth = {
|
||||
user: User | null;
|
||||
password_default: string;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user