Hello Everyone,
I have been seen a lot of people were asking about 'Forget Password' strange behavior in CRM Portal.
CRM Portal provides Forget Password option like other portal or websites, that allows users to reset their password if they have either forgotten their password or triggered an intruder lockout to authenticate with an alternate factor and repair their own problem, without calling the help desk.
CRM Portal ask the user to enter an email address in order to send password reset link. But it does not check whether email exists in CRM or for duplicate contact of same email address.
You either get an error message or not receive the email due to following reasons :
- If multiple contacts found of same email address in CRM.
- If the entered email address does not exist in CRM.
- Is the email address written correctly in the contact and on the password reset control?
Although people have posted this in Microsoft Dynamics 365 Ideas Portal (
here), but not sure whether this would be included in the future release or not.
Solution 1 -
Enable duplicate detection rule in CRM and create a new rule to warn users to not create duplicate contact of same email address. But by doing this, you can only warn or give a message to the user but cannot restrict from contact creation of same email address.
Also, by doing this you can only check for duplicate contacts of same email address, not whether the user exists or not.
Solution 2 -
Create a new Content Snippet record
Name - Account/ForgotPassword/PageCopy
Website - <website name>
Value - text
Hide, out of box Send button and create your own custom button
$(window).load(function() {
$('#submit-forgot-password').hide();
$('#submit-forgot-password').after('<input type="button" value="Send" id="checkemailId">');
// You can apply the CSS as well on the button by adding a Style tag to it.
});
Write OData query to check for duplicate contacts of same email address and to check whether email id exists in CRM or not.
Put it inside the window.load function.
$('#checkemailId').click(function () {
var inputEmailAddres = $("#Email").val();
var odataurl= "~/_odata/contacts?$filter=emailaddress1%20eq%20%27" + inputEmailAddres + "%27%20or%20emailaddress2%20eq%20%27" + inputEmailAddres + "%27";
$.ajax({
type: "GET",
url: odataurl,
dataType: 'json'
}).done(function (json) {
var contactsColl = json.value;
// If multiple email id found
if (contactsColl.length > 1)
{
alert("Multiple Contact Foundof entered email address");
}
// If Single email id found
if (contactsColl.length == 1)
{
$('#checkemailId').val('Sending...');
$('#submit-forgot-password').click();
}
// If email id not found
if (contactsColl.length == 0)
{
alert("Entered Email Id does not exist in system");
}
})
});