public ActionResult SendResetPasswordMail(string emailId, string Password) { string IsPasswordReset = string.Empty; Api.User.User ApiobjUser = new Api.User.User(); Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User(); string mailsender = ""; try { objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User))); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string changedpassword = Helper.SBUtils.MD5Hash(Password); IsPasswordReset = (string)new JavaScriptSerializer().Deserialize(ApiobjUser.ResetPassword(objuser.Id, changedpassword), typeof(string)); mailsender = "Password Changed Successfully"; if (IsPasswordReset == "1") { #region Commented & edited by Sumit Gupta [28-01-15] //objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User))); //try //{ // Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender(); // try // { // objuser.Password = Password; // var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_ResetPasswordMailBodyPartial", objuser); // string Subject = "New password for your Socioboard Account"; // mailsender = ApiobjMailSender.SendChangePasswordMail(emailId, mailBody, Subject); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} mailsender = "Success"; //Update IsKeyUsed to 1 //ApiobjUser.UpdateIsKeyUsed(objuser.Id.ToString()); #endregion } return(Content(mailsender)); }
public ActionResult SendResetPasswordMail(string emailId, string Password) { string IsPasswordReset = string.Empty; Api.User.User ApiobjUser = new Api.User.User(); Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User(); string mailsender = ""; try { objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User))); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string changedpassword = Helper.SBUtils.MD5Hash(Password); IsPasswordReset = (string)new JavaScriptSerializer().Deserialize(ApiobjUser.ResetPassword(objuser.Id, changedpassword), typeof(string)); mailsender = "Password Changed Successfully"; if (IsPasswordReset == "1") { objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User))); try { Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender(); try { objuser.Password = Password; var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_ResetPasswordMailBodyPartial", objuser); string Subject = "New password for your Socioboard Account"; mailsender = ApiobjMailSender.SendChangePasswordMail(emailId, mailBody, Subject); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } return(Content(mailsender)); }
public ActionResult SendResetPasswordMail(string emailId, string Password) { string IsPasswordReset = string.Empty; Api.User.User ApiobjUser = new Api.User.User(); Domain.Socioboard.Domain.User objuser = new Domain.Socioboard.Domain.User(); string mailsender = ""; try { objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User))); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string changedpassword = Helper.SBUtils.MD5Hash(Password); IsPasswordReset = (string)new JavaScriptSerializer().Deserialize(ApiobjUser.ResetPassword(objuser.Id, changedpassword), typeof(string)); mailsender = "Password Changed Successfully"; if (IsPasswordReset == "1") { #region Commented & edited by Sumit Gupta [28-01-15] //objuser = (Domain.Socioboard.Domain.User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUserInfoByEmail(emailId), typeof(Domain.Socioboard.Domain.User))); //try //{ // Api.MailSender.MailSender ApiobjMailSender = new Api.MailSender.MailSender(); // try // { // objuser.Password = Password; // var mailBody = Helper.SBUtils.RenderViewToString(this.ControllerContext, "_ResetPasswordMailBodyPartial", objuser); // string Subject = "New password for your Socioboard Account"; // mailsender = ApiobjMailSender.SendChangePasswordMail(emailId, mailBody, Subject); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} mailsender = "Success"; //Update IsKeyUsed to 1 //ApiobjUser.UpdateIsKeyUsed(objuser.Id.ToString()); #endregion } return Content(mailsender); }