Exemplo n.º 1
0
        public string chanagePassword(string username, string password)
        {
            UsersBLL bll    = new UsersBLL();
            int      userId = bll.CheckUserIDByUserName(username);

            if (bll.UpdatePass(password, userId) > 0)
            {
                return("ok");
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            UsersBLL bll      = new UsersBLL();
            string   username = txtUserName.Value;
            string   mobile   = txtMobile.Value;
            string   email    = txtEmail.Value;

            int userid = bll.CheckUserIDByUserName(username);

            if (userid > 0)
            {
                UserInfo item = bll.GetUserByID(userid);
                if (item != null)
                {
                    if (item.Mobile.Equals(mobile) && item.Email.Equals(email))
                    {
                        string newpass = Utils.CreateRandomCode(6).ToLower();
                        string sendstr = "尊敬的用户" + username + ",您要找回的用户密码是" + newpass + ",请您收好,并及时更改密码。";
                        if (SendMails(webset.EmailLoginName, email, "您找回的用户密码", sendstr, webset.SmtpServer, webset.EmailLoginName, webset.EmailLoginPass, true, "utf-8"))
                        {
                            bll.UpdatePass(Utils.MD5Encrypt32(newpass), userid);
                            Utils.alert("已向您的注册邮箱发送邮件,请注意查收!", "login.aspx");
                        }
                        else
                        {
                            Utils.alert("未知错误!", "index.aspx");
                        }
                    }
                    else
                    {
                        L_msg.Text = "<font color='red'>邮箱和手机号码输入错误!</font>";
                    }
                }
            }
            else
            {
                L_msg.Text = "<font color='red'>用户名不存在!</font>";
            }
        }