+ Start a Discussion
chaitanya Krishna 19chaitanya Krishna 19 

site forgot password link

Hey Team,

I am implementing partner portal in my project, Actually when ever user selects forgot password link the salesforce defaultly asks for the username and sends a reset link to the user email.
the use case is before sending the reset link we should check wether the user name existing in our org or not... if its existed then oly it should send the reset link...

i dont know how to acheive this... can any one help me with the source..
Best Answer chosen by chaitanya Krishna 19
Ravi Dutt SharmaRavi Dutt Sharma
Or you can have a check in your controller before calling Site.forgotPassword(username) method
 
userList=[SELECT Id FROM User WHERE Username =:username];
if(userList.size() == 0){
            // throw back an error
}

 

All Answers

Sagar PareekSagar Pareek
Similar question is already asked on this forum, please refer to this link -
https://developer.salesforce.com/forums/?id=906F0000000900lIAA
Ravi Dutt SharmaRavi Dutt Sharma
Hey Chaitanya,

Use Site.forgotPassword(username) method in your controller, it will handle all the required scenarios.
Ravi Dutt SharmaRavi Dutt Sharma
Or you can have a check in your controller before calling Site.forgotPassword(username) method
 
userList=[SELECT Id FROM User WHERE Username =:username];
if(userList.size() == 0){
            // throw back an error
}

 
This was selected as the best answer