sendResetEmail({ username: this.username.trim() })
.then(() => {
this.isLoading = false;
this.submitted = true;
this.successMessage = 'If an account exists for that username, a reset link has been sent to the associated email.';
this[NavigationMixin.Navigate]({
type : NAV_TYPE.WEB,
attributes : { url: PAGE.CHECK_PASSWORD.url }
});
})
.catch(() => {
this.isLoading = false;
this.errorMessage = 'Something went wrong. Please try again later.';
});
@AuraEnabled
public static void sendResetEmail(String username) {
Boolean result = Site.forgotPassword(username);
if (!result) {
AuraHandledException ex = new AuraHandledException('DIAGNOSTIC: Site.forgotPassword returned false for username: ' + username);
ex.setMessage('DIAGNOSTIC: Site.forgotPassword returned false for username: ' + username);
throw ex;
}
}
}
And from documentation It is mention if u are ousing other VF page it will return false.Buit i am not receiving any amail. How to fix it
#Experience Site #Experience Cloud #Digital Experience #Salesforce Developer