Beispiel #1
0
 protected void GetPasswordButtonClick(object sender, EventArgs e)
 {
     AuthMultiView.ActiveViewIndex = 2;
     if (GetPasswordButton.Text == "Done")
     {
         GetPasswordButton.Text        = "GET PASSWORD";
         AuthMultiView.ActiveViewIndex = 1;
     }
     else
     {
         var response = _customerInfoRepository.ForgotPassword(EmailForgotText.Text);
         if (response.IsSuccessful)
         {
             var url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path);
             url = string.Format("{0}?sp={1}", url, response.AccessKey);
             if (Request.Params["ReturnUrl"] != null)
             {
                 url = string.Format("{0}&ReturnUrl={1}", url, HttpUtility.UrlEncode(Request.Params["ReturnUrl"]));
             }
             var responseEmail = EmailHelper.EmailForgotPassword(EmailForgotText.Text.Trim().Replace(" ", ""),
                                                                 response.Message.FirstOrDefault(),
                                                                 url);
             MessageErrorForgotlabel.Text = "We have sent an email to reset your password, please check your email";
             MessageErrorForgotlabel.Attributes["style"] = "color:green !important;";
             GetPasswordButton.Text = "Done";
             CacheLayer.Clear(CacheKeys.CustomerInfosCacheKey);
         }
         else
         {
             MessageErrorForgotlabel.Text = response.Message.First();
             MessageErrorForgotlabel.Attributes["style"] = string.Empty;
         }
     }
 }
 protected void GetPasswordButtonClick(object sender, EventArgs e)
 {
     AuthMultiView.ActiveViewIndex = 2;
     if (Session["ReadyGetPassword"] != null)
     {
         GetPasswordButton.Text        = "GET PASSWORD";
         AuthMultiView.ActiveViewIndex = 1;
         ScriptManager.RegisterClientScriptBlock(UpdatePanel1,
                                                 typeof(string),
                                                 "hideAuthModal",
                                                 "$(function(){setTimeout(function(){$('#authModal').modal('hide');$('.modal-backdrop').remove();}, 50)});",
                                                 true);
         Session.Remove("ReadyGetPassword");
     }
     else
     {
         var response = _customerInfoRepository.ForgotPassword(EmailForgotText.Text);
         if (response.IsSuccessful)
         {
             var url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path);
             url = string.Format("{0}?sp={1}", url, response.AccessKey);
             if (Request.Params["ReturnUrl"] != null)
             {
                 url = string.Format("{0}&ReturnUrl={1}", url, HttpUtility.UrlEncode(Request.Params["ReturnUrl"]));
             }
             var responseEmail = EmailHelper.EmailForgotPassword(EmailForgotText.Text.Trim().Replace(" ", ""),
                                                                 response.Message.FirstOrDefault(),
                                                                 url);
             MessageErrorForgotlabel.Text = "We have sent an email to reset your password, please check your email";
             MessageErrorForgotlabel.Attributes["style"] = "color:green !important;";
             GetPasswordButton.Text      = "Done";
             Session["ReadyGetPassword"] = true;
             CacheLayer.Clear(CacheKeys.CustomerInfosCacheKey);
         }
         else
         {
             MessageErrorForgotlabel.Text = response.Message.First();
             MessageErrorForgotlabel.Attributes["style"] = string.Empty;
         }
     }
 }
Beispiel #3
0
    private void RemindPassword()
    {
        var response = _customerInfoRepository.ForgotPassword(tbEmail.Text);

        if (response.IsSuccessful)
        {
            var url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path);
            url = string.Format("{0}?q={1}", url, response.AccessKey);
            if (Request.Params["ReturnUrl"] != null)
            {
                url = string.Format("{0}&ReturnUrl={1}", url, HttpUtility.UrlEncode(Request.Params["ReturnUrl"]));
            }
            var responseEmail = EmailHelper.EmailForgotPassword(tbEmail.Text.Trim().Replace(" ", string.Empty),
                                                                response.Message.FirstOrDefault(),
                                                                url);
            lblMessage.Text = "We have sent an email to reset your password, please check your email";
            lblMessage.Attributes["style"] = "color:green !important;";
            btnGetPassword.Enabled         = false;
            CacheLayer.Clear(CacheKeys.CustomerInfosCacheKey);
        }
    }