3636 >
3737 {{ t('auth.login.passwordLabel') }}
3838 </label >
39- <span class =" text-muted text-base font-medium cursor-pointer" >
39+ <span
40+ class =" text-muted text-base font-medium cursor-pointer"
41+ @click =" handleForgotPassword($form.email?.value)"
42+ >
4043 {{ t('auth.login.forgotPassword') }}
4144 </span >
4245 </div >
@@ -79,11 +82,13 @@ import { useI18n } from 'vue-i18n'
7982
8083import { type SignInData , signInSchema } from ' @/schemas/signInSchema'
8184import { useFirebaseAuthStore } from ' @/stores/firebaseAuthStore'
85+ import { useToastStore } from ' @/stores/toastStore'
8286
8387const authStore = useFirebaseAuthStore ()
8488const loading = computed (() => authStore .loading )
8589
8690const { t } = useI18n ()
91+ const toast = useToastStore ()
8792
8893const emit = defineEmits <{
8994 submit: [values : SignInData ]
@@ -94,4 +99,22 @@ const onSubmit = (event: FormSubmitEvent) => {
9499 emit (' submit' , event .values as SignInData )
95100 }
96101}
102+
103+ const handleForgotPassword = async (email : string ) => {
104+ if (! email ) return
105+ await authStore .sendPasswordReset (email )
106+ if (authStore .error ) {
107+ toast .add ({
108+ severity: ' error' ,
109+ summary: t (' auth.login.forgotPasswordError' ),
110+ detail: authStore .error
111+ })
112+ } else {
113+ toast .add ({
114+ severity: ' success' ,
115+ summary: t (' auth.login.passwordResetSent' ),
116+ detail: t (' auth.login.passwordResetSentDetail' )
117+ })
118+ }
119+ }
97120 </script >
0 commit comments