当前位置: 首页>>代码示例>>C#>>正文


C# UserRepository.ResetPassword方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:utkarshx,项目名称:socioboard,代码行数:22,代码来源:ResetPassword.aspx.cs

示例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);
            }
        }
开发者ID:JBNavadiya,项目名称:socioboard,代码行数:62,代码来源:ForgotPassword.aspx.cs


注:本文中的SocioBoard.Model.UserRepository.ResetPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。