本文整理汇总了C#中SocioBoard.Model.UserRepository.ResetPassword方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.ResetPassword方法的具体用法?C# UserRepository.ResetPassword怎么用?C# UserRepository.ResetPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocioBoard.Model.UserRepository
的用法示例。
在下文中一共展示了UserRepository.ResetPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnResetPwd_Click
protected void btnResetPwd_Click(object sender, EventArgs e)
{
try
{
Registration regpage = new Registration();
string changedpassword = regpage.MD5Hash(txtpass.Text);
UserRepository userrepo = new UserRepository();
if (userrepo.ResetPassword(Guid.Parse(userid.ToString()), changedpassword.ToString()) > 0)
{
lblerror.Text = "Password Reset Successfully";
}
else
{
lblerror.Text = "Problem Password Reset";
}
}
catch (Exception Err)
{
logger.Error(Err.StackTrace);
}
}
示例2: btnResetPwd_Click
protected void btnResetPwd_Click(object sender, ImageClickEventArgs e)
{
UserRepository userrepo = new UserRepository();
try
{
Registration regpage = new Registration();
if (txtpass.Text == txtconfirmpass.Text)
{
string changedpassword = regpage.MD5Hash(txtpass.Text);
if (userrepo.ResetPassword(Guid.Parse(userid.ToString()), changedpassword.ToString()) > 0)
{
User usr = userrepo.getUsersById(Guid.Parse(userid.ToString()));
// Code written by Abhay Kr Mondal 8/8/2014
///below block of code is used to send email with user information
///Begin
string strUrl = string.Empty;
string URL = Request.Url.AbsoluteUri;
//strUrl = URL.Replace("ForgetPassword.aspx", "ChangePassword.aspx" + "?str=" + regObject.MD5Hash(txtEmail.Text) + "&type=forget");
//strUrl = (strUrl + "?userid=" + usr.Id).ToString();
string mailpath = HttpContext.Current.Server.MapPath("~/Layouts/Mails/UserInfo.htm");
string MailBody = File.ReadAllText(mailpath);
MailBody = MailBody.Replace("%FN%", usr.UserName);
MailBody = MailBody.Replace("%UN%", usr.EmailId);
MailBody = MailBody.Replace("%PWD%", txtpass.Text.ToString());
string username = ConfigurationManager.AppSettings["username"];
string host = ConfigurationManager.AppSettings["host"];
string port = ConfigurationManager.AppSettings["port"];
string pass = ConfigurationManager.AppSettings["password"];
string from = ConfigurationManager.AppSettings["fromemail"];
// string Body = mailformat.VerificationMail(MailBody, txtEmail.Text.ToString(), "");
string Subject = "New Password for Your Socioboard Account";
//MailHelper.SendMailMessage(host, int.Parse(port.ToString()), username, pass, txtEmail.Text.ToString(), string.Empty, string.Empty, Subject, MailBody);
MailHelper.SendSendGridMail(host, Convert.ToInt32(port), from, "", usr.EmailId.ToString(), string.Empty, string.Empty, Subject, MailBody, username, pass);
// lblerror.Text = "Please check your mail for the instructions.";
// Code written by Abhay Kr Mondal 8/8/2014
///below block of code is used to send email with user information
lblerror.Text = "Password Reset Successfully";
}
else
{
lblerror.Text = "Problem while resetting password";
}
}
else
{
lblerror.Text = "Password mismatch!";
}
}
catch (Exception Err)
{
logger.Error(Err.StackTrace);
}
}