diff --git a/app/components/forms/auth/new-password-form.vue b/app/components/forms/auth/new-password-form.vue index 07cb57f..bdc3a11 100644 --- a/app/components/forms/auth/new-password-form.vue +++ b/app/components/forms/auth/new-password-form.vue @@ -4,14 +4,14 @@ const props = defineProps<{ email: string }>(); -const {resetPasswordWithToken} = useAuth(); +const {resetPassword} = useAuth(); const password = ref(""); const passwordConfirmation = ref(""); const tokenExpired = ref(false); const handlePasswordReset = () => { try { - resetPasswordWithToken(password.value, passwordConfirmation.value, props.token, props.email); + resetPassword(password.value, passwordConfirmation.value, props.token, props.email); } catch (error: unknown) { if (error instanceof Error && error.message === "TOKEN_EXPIRED") tokenExpired.value = true; diff --git a/app/components/forms/password-reset-form.vue b/app/components/forms/password-reset-form.vue index 6867e21..8489fd2 100644 --- a/app/components/forms/password-reset-form.vue +++ b/app/components/forms/password-reset-form.vue @@ -1,49 +1,18 @@ @@ -53,12 +22,4 @@ const handlePasswordReset = async () => { flex-direction: column; gap: 1rem; } - -.error-message { - color: var(--color-error-text); -} - -.success-message { - color: var(--color-button-primary); -} \ No newline at end of file diff --git a/app/components/profile-menu.vue b/app/components/profile-menu.vue index 8d43f6f..93f2171 100644 --- a/app/components/profile-menu.vue +++ b/app/components/profile-menu.vue @@ -26,7 +26,7 @@ onUnmounted(() => document.removeEventListener('click', onClickOutside)) diff --git a/app/composables/useAuth.ts b/app/composables/useAuth.ts index 0aeb857..6c0fd76 100644 --- a/app/composables/useAuth.ts +++ b/app/composables/useAuth.ts @@ -37,32 +37,12 @@ export const useAuth = () => { await navigateTo('/auth/login') } - const resetPassword = async (password: string, passwordConfirmation: string, currentPassword: string) => { + const resetPassword = async (password: string, passwordConfirmation: string, token: string, email: string) => { await $fetch('/sanctum/csrf-cookie', { baseURL: config.public.apiBase, credentials: 'include', }) await $api('/api/reset-password', { - method: 'POST', - body: { - password, - password_confirmation: passwordConfirmation, - current_password: currentPassword - }, - onResponseError: ({response}) => { - const err = new Error(response._data?.message ?? 'Failed to reset password'); - (err as any).errors = response._data?.errors ?? {} - throw err - } - }) - } - - const resetPasswordWithToken = async (password: string, passwordConfirmation: string, token: string, email: string) => { - await $fetch('/sanctum/csrf-cookie', { - baseURL: config.public.apiBase, - credentials: 'include', - }) - await $api('/api/reset-password-token', { method: 'POST', body: { password, @@ -79,20 +59,6 @@ export const useAuth = () => { await navigateTo('/lists') } - const forgotPassword = async (email: string) => { - await $fetch('/sanctum/csrf-cookie', { - baseURL: config.public.apiBase, - credentials: 'include', - }) - await $api('/api/forgot-password', { - method: 'POST', - body: { - email - }, - }) - await navigateTo('/login') - } - const xsrfToken = useCookie('XSRF-TOKEN') const logout = async () => { @@ -111,5 +77,5 @@ export const useAuth = () => { navigateTo('/auth/login') } - return {login, register, forgotPassword, resetPassword, resetPasswordWithToken, logout} + return {login, register, resetPassword, logout} } diff --git a/app/middleware/auth.global.ts b/app/middleware/auth.global.ts index e637b34..b329c1f 100644 --- a/app/middleware/auth.global.ts +++ b/app/middleware/auth.global.ts @@ -2,8 +2,7 @@ export default defineNuxtRouteMiddleware((to) => { const publicRoutes = [ 'auth-login', 'auth-register', - 'auth-reset-password-token', - 'auth-forgot-password', + 'auth-reset-password', 'invitations-token-accept', 'invitations-token-decline', ] diff --git a/app/pages/account-settings.vue b/app/pages/account.vue similarity index 100% rename from app/pages/account-settings.vue rename to app/pages/account.vue diff --git a/app/pages/auth/forgot-password.vue b/app/pages/auth/forgot-password.vue deleted file mode 100644 index 1d6b45b..0000000 --- a/app/pages/auth/forgot-password.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/pages/auth/login.vue b/app/pages/auth/login.vue index 6f612a8..42ca645 100644 --- a/app/pages/auth/login.vue +++ b/app/pages/auth/login.vue @@ -10,16 +10,11 @@ definePageMeta({

Log in

- Forgot Your Password?