Reputation: 706
I have made custom login control for DNN (DotNetNuke). Now I am trying to implement the forgot password feature. I am able to retrieve password from the database using the code:
UserInfo uInfo = UserController.GetUserByName(this.PortalId, userName);
if (uInfo != null)
{
string password = UserController.GetPassword(ref uInfo, String.Empty);
}
I want to send the retrieved password to the user using DNN.
Any help will be appreciated.
Upvotes: 3
Views: 2206
Reputation: 250
Sending passwords via email is considered as a big security vulnerability and really not recomended.
If you still need this functionality though, I guess you can simply accomplish this by sending email through SendMail
or SendEmail
methods:
DotNetNuke.Services.Mail.Mail.SendEmail()
DotNetNuke.Services.Mail.Mail.SendMail()
The SendMail
method provides more options/parameters than the SendEmail
method. The paramters names should be self explanatory enough to use the methods.
Upvotes: 1
Reputation: 156005
The simplest way to send a user their password is to call the DotNetNuke.Services.Mail.Mail.SendMail
overload that takes a UserInfo
, a MessageType
, and PortalSettings
. You can pass in the user and MessageType. PasswordReminder
and DNN will take care of the rest.
That said, I join the crowd in saying that it would be much better to switch to using hashed passwords and consider this an impossible feature request (that should, instead, be fulfilled with a password reset feature).
Upvotes: 1