All checks were successful
CI / container-job (push) Successful in 41s
- adonisrc.ts: Load official drive_provider and unload custom driver_provider. - packages.json: Add @headlessui/vue dependency for tab components. - AvatarController.ts: Rewrite avatar generation logic to always return the same avatar per user. - auth/UserController.ts: Add profile and profileUpdate methods to support user profile editing. - Submitter/datasetController.ts & app/models/file.ts: Adapt code to use the official drive_provider. - app/models/user.ts: Introduce “isAdmin” getter. - config/drive.ts: Create new configuration for the official drive_provider. - providers/vinejs_provider.ts: Adapt allowedExtensions control to use provided options or database enabled extensions. - resource/js/app.ts: Load default Head and Link components. - resources/js/menu.ts: Add settings-profile.edit menu point. - resources/js/Components/action-message.vue: Add new component for improved user feedback after form submissions. - New avatar-input.vue component: Enable profile picture selection. - Components/CardBox.vue: Alter layout to optionally show HeaderIcon in title bar. - FormControl.vue: Define a readonly prop for textareas. - Improve overall UI with updates to NavBar.vue, UserAvatar.vue, UserAvatarCurrentUser.vue, and add v-model support to password-meter.vue. - Remove profile editing logic from AccountInfo.vue and introduce new profile components (show.vue, update-password-form.vue, update-profile-information.vue). - app.edge: Modify page (add @inertiaHead tag) for better meta management. - routes.ts: Add new routes for editing user profiles. - General npm updates.
135 lines
No EOL
5.1 KiB
Vue
135 lines
No EOL
5.1 KiB
Vue
<script lang="ts" setup>
|
|
import FormControl from '@/Components/FormControl.vue';
|
|
import FormField from '@/Components/FormField.vue';
|
|
import ActionMessage from '@/Components/action-message.vue'
|
|
import BaseButton from '@/Components/BaseButton.vue';
|
|
import BaseButtons from '@/Components/BaseButtons.vue';
|
|
import { useForm, usePage } from '@inertiajs/vue3';
|
|
import { ref, Ref, computed } from 'vue';
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
|
import CardBox from '@/Components/CardBox.vue';
|
|
import { mdiLock } from '@mdi/js';
|
|
import PasswordMeter from '@/Components/SimplePasswordMeter/password-meter.vue';
|
|
// import BaseDivider from '@/Components/BaseDivider.vue';
|
|
|
|
// const errors: Ref<any> = computed(() => {
|
|
// return usePage().props.errors;
|
|
// });
|
|
const flash: Ref<any> = computed(() => {
|
|
return usePage().props.flash;
|
|
});
|
|
|
|
const newPasswordInput: Ref<typeof FormControl | null> = ref(null);
|
|
const oldPasswordInput: Ref<typeof FormControl | null> = ref(null);
|
|
|
|
const enabled = ref(false);
|
|
const handleScore = (score: number) => {
|
|
if (score >= 4) {
|
|
enabled.value = true;
|
|
} else {
|
|
enabled.value = false;
|
|
}
|
|
// strengthLabel.value = scoreLabel;
|
|
// score.value = scoreValue;
|
|
};
|
|
|
|
const form = useForm({
|
|
old_password: '',
|
|
new_password: '',
|
|
confirm_password: '',
|
|
});
|
|
const updatePassword = async () => {
|
|
await form.put(stardust.route('settings.password.update'), {
|
|
preserveScroll: true,
|
|
onSuccess: () => {
|
|
form.reset();
|
|
},
|
|
onError: () => {
|
|
if (form.errors.new_password) {
|
|
form.reset('new_password', 'confirm_password');
|
|
enabled.value = false;
|
|
// newPasswordInput.value.focus();
|
|
// newPasswordInput.value?.focus();
|
|
}
|
|
|
|
if (form.errors.old_password) {
|
|
form.reset('old_password');
|
|
// oldPasswordInput.value?.focus();
|
|
}
|
|
},
|
|
});
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<!-- <div class="p-7 text-gray-900 bg-white rounded-lg border border-gray-100 shadow dark:border-gray-600 dark:bg-secondary-dark dark:text-white"> -->
|
|
|
|
|
|
|
|
|
|
<!-- <div class="mb-4">
|
|
<h3 class="text-dark text-md">{{ 'Update Password' }}</h3>
|
|
</div> -->
|
|
|
|
<CardBox id="passwordForm" title="Change Password" :icon="mdiLock" form :show-header-icon="false">
|
|
|
|
|
|
|
|
<FormField label="Current password" help="Required. Your current password"
|
|
:class="{ 'text-red-400': form.errors.old_password }">
|
|
<FormControl label="Current Password" id="current_password" ref="oldPasswordInput"
|
|
:placeholder="'Please Enter Current Password'" v-model="form.old_password"
|
|
:error="form.errors.old_password" type="password" class="block w-full" autocomplete="current-password">
|
|
<div class="text-red-400 text-sm" v-if="form.errors.old_password">
|
|
{{ form.errors.old_password }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
|
|
<!-- <div class="col-span-6 sm:col-span-4"> -->
|
|
<!-- <FormControl label="New Password" id="password" :placeholder="'Please Enter New Password'"
|
|
ref="newPasswordInput" v-model="form.new_password" type="password" class="block w-full"
|
|
autocomplete="new-password" :error="form.errors.new_password">
|
|
<div class="text-red-400 text-sm" v-if="form.errors.new_password">
|
|
{{ form.errors.new_password }}
|
|
</div>
|
|
</FormControl> -->
|
|
<PasswordMeter ref="newPasswordInput" v-model="form.new_password" :errors="form.errors"
|
|
@score="handleScore" />
|
|
|
|
<!-- </div> -->
|
|
|
|
<FormField label="Confirm password" help="Required. New password one more time"
|
|
:class="{ 'text-red-400': form.errors.confirm_password }">
|
|
<FormControl label="Confirm Password" :placeholder="'Please Enter Confirm Password'" id="confirm_password"
|
|
v-model="form.confirm_password" type="password" class="block w-full" autocomplete="new-password"
|
|
:error="form.errors.confirm_password">
|
|
<div class="text-red-400 text-sm" v-if="form.errors.confirm_password">
|
|
{{ form.errors.confirm_password }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<!-- <BaseDivider /> -->
|
|
|
|
<template #footer>
|
|
|
|
|
|
|
|
<div class="flex items-center justify-end gap-3 mt-5">
|
|
<ActionMessage v-if="flash.message" :on="form.recentlySuccessful" color="success">
|
|
{{ flash.message }}
|
|
</ActionMessage>
|
|
<ActionMessage v-if="flash.warning" :on="form.recentlySuccessful" color="warning">
|
|
{{ flash.warning }}
|
|
</ActionMessage>
|
|
<BaseButtons>
|
|
<BaseButton type="submit" color="info" label="Change password" @click.prevent="updatePassword()"
|
|
:disabled="form.processing == true || enabled == false" />
|
|
</BaseButtons>
|
|
</div>
|
|
</template>
|
|
</CardBox>
|
|
</template> |