Ejemplo n.º 1
0
        protected override void OnPreRender(EventArgs e)
        {
            ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.jquery.extensions.js");
            ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.jquery.tooltip.js");
            ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.PasswordStrength.js");
            ClientResourceManager.RegisterScript(Page, "~/DesktopModules/Admin/Security/Scripts/dnn.PasswordComparer.js");

            jQuery.RequestDnnPluginsRegistration();

            base.OnPreRender(e);


			if (Host.EnableStrengthMeter)
			{
				passwordContainer.CssClass = "password-strength-container";
				txtPassword.CssClass = "password-strength";
				txtConfirm.CssClass = string.Format("{0} checkStength", txtConfirm.CssClass);
				
				var options = new DnnPaswordStrengthOptions();
				var optionsAsJsonString = Json.Serialize(options);
				var passwordScript = string.Format("dnn.initializePasswordStrength('.{0}', {1});{2}",
					"password-strength", optionsAsJsonString, Environment.NewLine);

				if (ScriptManager.GetCurrent(Page) != null)
				{
					// respect MS AJAX
					ScriptManager.RegisterStartupScript(Page, GetType(), "PasswordStrength", passwordScript, true);
				}
				else
				{
					Page.ClientScript.RegisterStartupScript(GetType(), "PasswordStrength", passwordScript, true);
				}
			}

			var confirmPasswordOptions = new DnnConfirmPasswordOptions()
			{
				FirstElementSelector = "#" + passwordContainer.ClientID + " input[type=password]",
				SecondElementSelector = ".password-confirm",
				ContainerSelector = ".dnnFormPassword",
				UnmatchedCssClass = "unmatched",
				MatchedCssClass = "matched"
			};

			var confirmOptionsAsJsonString = Json.Serialize(confirmPasswordOptions);
			var confirmScript = string.Format("dnn.initializePasswordComparer({0});{1}", confirmOptionsAsJsonString, Environment.NewLine);

			if (ScriptManager.GetCurrent(Page) != null)
			{
				// respect MS AJAX
				ScriptManager.RegisterStartupScript(Page, GetType(), "ConfirmPassword", confirmScript, true);
			}
			else
			{
				Page.ClientScript.RegisterStartupScript(GetType(), "ConfirmPassword", confirmScript, true);
			}
        }
Ejemplo n.º 2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (!string.IsNullOrEmpty(lblHelp.Text) || !string.IsNullOrEmpty(lblInfo.Text))
                resetMessages.Visible = true;

            var options = new DnnPaswordStrengthOptions();
            var optionsAsJsonString = Json.Serialize(options);
            var script = string.Format("dnn.initializePasswordStrength('.{0}', {1});{2}",
                "password-strength", optionsAsJsonString, Environment.NewLine);

            if (ScriptManager.GetCurrent(Page) != null)
            {
                // respect MS AJAX
                ScriptManager.RegisterStartupScript(Page, GetType(), "PasswordStrength", script, true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "PasswordStrength", script, true);
            }

            var confirmPasswordOptions = new DnnConfirmPasswordOptions()
            {
                FirstElementSelector = ".password-strength",
                SecondElementSelector = ".password-confirm",
                ContainerSelector = ".dnnPasswordReset",
                UnmatchedCssClass = "unmatched",
                MatchedCssClass = "matched"
            };

            optionsAsJsonString = Json.Serialize(confirmPasswordOptions);
            script = string.Format("dnn.initializePasswordComparer({0});{1}", optionsAsJsonString, Environment.NewLine);

            if (ScriptManager.GetCurrent(Page) != null)
            {
                // respect MS AJAX
                ScriptManager.RegisterStartupScript(Page, GetType(), "ConfirmPassword", script, true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "ConfirmPassword", script, true);
            }
        }
Ejemplo n.º 3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);


			if (Host.EnableStrengthMeter)
			{
				passwordContainer.CssClass = "password-strength-container";
				txtNewPassword.CssClass = "password-strength";

				var options = new DnnPaswordStrengthOptions();
				var optionsAsJsonString = Json.Serialize(options);
				var script = string.Format("dnn.initializePasswordStrength('.{0}', {1});{2}",
					"password-strength", optionsAsJsonString, Environment.NewLine);

				if (ScriptManager.GetCurrent(Page) != null)
				{
					// respect MS AJAX
					ScriptManager.RegisterStartupScript(Page, GetType(), "PasswordStrength", script, true);
				}
				else
				{
					Page.ClientScript.RegisterStartupScript(GetType(), "PasswordStrength", script, true);
				}
			}

			var confirmPasswordOptions = new DnnConfirmPasswordOptions()
			{
				FirstElementSelector = "#" + passwordContainer.ClientID + " input[type=password]",
				SecondElementSelector = ".password-confirm",
				ContainerSelector = ".dnnPassword",
				UnmatchedCssClass = "unmatched",
				MatchedCssClass = "matched"
			};

			var confirmOptionsAsJsonString = Json.Serialize(confirmPasswordOptions);
			var confirmScript = string.Format("dnn.initializePasswordComparer({0});{1}", confirmOptionsAsJsonString, Environment.NewLine);

			if (ScriptManager.GetCurrent(Page) != null)
			{
				// respect MS AJAX
				ScriptManager.RegisterStartupScript(Page, GetType(), "ConfirmPassword", confirmScript, true);
			}
			else
			{
				Page.ClientScript.RegisterStartupScript(GetType(), "ConfirmPassword", confirmScript, true);
			}
        }
Ejemplo n.º 4
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            var confirmPasswordOptions = new DnnConfirmPasswordOptions()
            {
                FirstElementSelector = "." + PasswordStrengthTextBoxCssClass,
                SecondElementSelector = "." + ConfirmPasswordTextBoxCssClass,
                ContainerSelector = ".dnnRegistrationForm",
                UnmatchedCssClass = "unmatched",
                MatchedCssClass = "matched"
            };

            var optionsAsJsonString = Json.Serialize(confirmPasswordOptions);
            var script = string.Format("dnn.initializePasswordComparer({0});{1}", optionsAsJsonString, Environment.NewLine);

            if (ScriptManager.GetCurrent(Page) != null)
            {
                // respect MS AJAX
                ScriptManager.RegisterStartupScript(Page, GetType(), "ConfirmPassword", script, true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "ConfirmPassword", script, true);
            }

        }