/// <summary> /// Method to retrieve password /// </summary> /// <param name="userName"></param> /// <returns></returns> public string ForgetPassword(string userName) { #region string result = "Sorry! We could not find a user registered with that email address."; MemberAction objMember = new MemberAction(); try { string memberPwd = objMember.GetPwdByUserName(userName); if (memberPwd.Length == 0) { result = "Test123"; } } catch (Exception ex) { result = ex.InnerException.ToString(); } return result; #endregion }
public ActionResult ForgotPassword(RegisterModel objPwdModel) { #region Send Mail for password MemberAction objMember = new MemberAction(); string memberPwd = objMember.GetPwdByUserName(objPwdModel.ForgotUserName); if (!string.IsNullOrEmpty(memberPwd)) { //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(objPwdModel.ForgotUserName); arrTokens.Add(memberPwd); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = objPwdModel.ForgotUserName; objSendMail.Subject = "email.forget.password.subject.content"; objSendMail.MsgBody = "email.forget.password.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail); ViewData["Message"] = "Your password has been sent to the specified email address. Please check your email to find out the password."; return View("PasswordSent"); } else { ViewData["Message"] = "Sorry! We could not find a user registered with that email address"; return View("PasswordSent"); } #endregion }
/// <summary> /// Method to retrive password /// </summary> /// <param name="username"></param> /// <returns></returns> public bool ForgotPassword(string username) { MemberAction objMember = new MemberAction(); string memberPwd = objMember.GetPwdByUserName(username); if (!string.IsNullOrEmpty(memberPwd)) { //send automated email - content of email will be decided later // Creating array list for token ArrayList arrTokens = new ArrayList(); arrTokens.Add(username); arrTokens.Add(memberPwd); // Filling mail object SendMail objSendMail = new SendMail(); objSendMail.ToEmailId = username; objSendMail.Subject = "email.forget.password.subject.content"; objSendMail.MsgBody = "email.forget.password.body.content"; objSendMail.ChangesInMessage = arrTokens; objSendMail.SendEmail(objSendMail);//SendMail.(member.username, SystemStatements.DEFAUL_EMAIL_ADDRESS, SystemStatements.EMAIL_SUBJECT_SIGNUP, ""); return true; } else { return false; } }