protected void btnForgotPwd_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                bool exist = false;
                UserRepository objUserRepo = new UserRepository();
                Registration regObject = new Registration();

                if (!string.IsNullOrEmpty(txtEmail.Text))
                {
                    string strUrl = string.Empty;
                    // c.customer_email = txtEmail.Text.Trim();
                    // exist = custrepo.ExistedCustomerEmail(c);
                    User usr = objUserRepo.getUserInfoByEmail(txtEmail.Text);

                    if (usr != null)
                    {
                        string URL = Request.Url.AbsoluteUri;
                        //strUrl = Server.MapPath("~/ChangePassword.aspx") + "?str=" + txtEmail.Text + "&type=forget";
                        strUrl = URL.Replace("ForgetPassword.aspx", "ChangePassword.aspx" + "?str=" + regObject.MD5Hash(txtEmail.Text) + "&type=forget");
                        strUrl = (strUrl+"?userid=" + usr.Id).ToString();

                        string MailBody = "<body bgcolor=\"#FFFFFF\"><!-- Email Notification from socialcrowd.com-->" +
                    "<table id=\"Table_01\" style=\"margin-top: 50px; margin-left: auto; margin-right: auto;\"" +
                    " align=\"center\" width=\"650px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" ><tr>" +
                   "<td height=\"20px\" style=\"background-color: rgb(222, 222, 222); text-align: center; font-size: 15px; font-weight: bold; font-family: Arial; color: rgb(51, 51, 51); float: left; width: 100%; margin-top: 7px; padding-top: 10px; border-bottom: 1px solid rgb(204, 204, 204); padding-bottom: 10px;\">" +
                       "WooSuite</td></tr><!--Email content--><tr>" +
                   "<td style=\"background-color: #dedede; padding-top: 10px; padding-left: 25px; padding-right: 25px; padding-bottom: 30px; font-family: Tahoma; font-size: 14px; color: #181818; min-height: auto;\"><p>Hi , " + usr.UserName + "</p><p>" +
                       "As your request, Reset Password information to Click This Link : <a href=" + strUrl + " style=\"text-decoration:none;\">Reset Password</a></td></tr><tr>" +
                   "<td style=\"background-color: rgb(222, 222, 222); margin-top: 10px; padding-left: 20px; height: 20px; color: rgb(51, 51, 51); font-size: 15px; font-family: Arial; border-top: 1px solid rgb(204, 204, 204); padding-bottom: 10px; padding-top: 10px;\">Thanks" +
                   "</td></tr></table><!-- End Email Notification From SocioCrowd.socioboard.com --></body>";

                        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 = "Forget Password Social Crowd 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, "", txtEmail.Text.ToString(), string.Empty, string.Empty, Subject, MailBody, username, pass);

                        lblerror.Text = "Your Password Changes info to send in your Email";
                    }
                    else
                    {
                        lblerror.Text = "Your Email is wrong Please try another one";
                    }

                }
            }
            catch (Exception Err)
            {
                logger.Error(Err.StackTrace);
            }
        }
        public void changePassoword(object sender, EventArgs e)
        {
            if (txtPassword.Text != "" && txtConfirmPassword.Text != "")
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    User user = (User)Session["LoggedUser"];
                    Registration regpage = new Registration();
                    string changedpassword = regpage.MD5Hash(txtConfirmPassword.Text);
                    UserRepository userrepo = new UserRepository();
                    userrepo.ChangePassword(changedpassword, user.Password, user.EmailId);
                    txtConfirmPassword.Text = string.Empty;
                    txtPassword.Text = string.Empty;
                }
                else
                {

                }
            }
            else
            {

            }
        }
        protected void btnResetPwd_Click(object sender, ImageClickEventArgs 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);
            }
        }
示例#4
0
        public string Register(string EmailId, string Password, string AccountType, string FirstName, string LastName)
        {
            try
            {
                UserRepository userrepo = new UserRepository();
                if (!userrepo.IsUserExist(EmailId))
                {
                    Registration regObject = new Registration();
                    User user = new User();
                    user.AccountType = AccountType;
                    user.EmailId = EmailId;
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Password = regObject.MD5Hash(Password);
                    user.PaymentStatus = "unpaid";
                    user.ProfileUrl = string.Empty;
                    user.TimeZone = string.Empty;
                    user.UserName = FirstName + " " + LastName;
                    user.UserStatus = 1;
                    user.Id = Guid.NewGuid();
                    UserRepository.Add(user);
                    MailSender.SendEMail(user.UserName,Password, EmailId);
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Email Already Exists";
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }
        }
示例#5
0
        public string Login(string EmailId, string Password)
        {
            //
            try
            {
                UserRepository userrepo = new UserRepository();
                Registration regObject = new Registration();
                User user = userrepo.GetUserInfo(EmailId, regObject.MD5Hash(Password));

                if (user != null)
                {
                    return new JavaScriptSerializer().Serialize(user);
                }
                else
                {
                    return "Invalid user name or password";
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return null;
            }
        }