Ejemplo n.º 1
0
        /// <summary>
        /// Save dei dati della password
        /// </summary>
        protected void SavePasswordConfigurations()
        {
            if (this.IsSupportedPasswordConfig())
            {
                int idAmministrazione = this.GetIdAmministrazione();

                SAAdminTool.DocsPaWR.PasswordConfigurations pwdConfigurations = new SAAdminTool.DocsPaWR.PasswordConfigurations();

                pwdConfigurations.IdAmministrazione = this.GetIdAmministrazione();

                int validationDaysIfEnabled;
                if (Int32.TryParse(this.txtPasswordValidityDays.Text, out validationDaysIfEnabled))
                {
                    pwdConfigurations.ValidityDays = validationDaysIfEnabled;
                }
                pwdConfigurations.ExpirationEnabled = (validationDaysIfEnabled > 0);

                int pwdMinLenght;
                if (Int32.TryParse(this.txtPasswordMinLength.Text, out pwdMinLenght))
                {
                    pwdConfigurations.MinLength = pwdMinLenght;
                }
                else
                {
                    pwdConfigurations.MinLength = 0;
                }

                pwdConfigurations.SpecialCharacters = this.txtPasswordSpecialChars.Text.ToCharArray();

                SAAdminTool.DocsPaWR.DocsPaWebService ws = new SAAdminTool.DocsPaWR.DocsPaWebService();

                SAAdminTool.AdminTool.Manager.SessionManager sessionManager = new SAAdminTool.AdminTool.Manager.SessionManager();

                if (!ws.AdminSavePasswordConfigurations(sessionManager.getUserAmmSession(), pwdConfigurations))
                {
                    // Aggiornamento dei dati non andato a buon fine
                    this.Page.Response.Write("<script>alert('Si è verificato un errore nell\\'aggiornamento delle configurazioni delle password.');</script>");
                }
                else
                {
                    if (!this.Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "SavePasswordConfigCompleted"))
                    {
                        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "SavePasswordConfigCompleted", "<script>SavePasswordConfigCompleted();</script>");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Inizializzazione campi scadenza password
        /// </summary>
        private void LoadPasswordConfigurations()
        {
            //// Gestione abilitazione / disabilitazione campi scadenza password
            this.EnablePasswordControls();

            if (this.IsSupportedPasswordConfig())
            {
                SAAdminTool.DocsPaWR.DocsPaWebService ws = new SAAdminTool.DocsPaWR.DocsPaWebService();

                SAAdminTool.AdminTool.Manager.SessionManager sessionManager = new SAAdminTool.AdminTool.Manager.SessionManager();

                SAAdminTool.DocsPaWR.PasswordConfigurations pwdConfigurations = ws.AdminGetPasswordConfigurations(sessionManager.getUserAmmSession(), this.GetIdAmministrazione());

                if (pwdConfigurations.MinLength > 0)
                {
                    this.txtPasswordMinLength.Text = pwdConfigurations.MinLength.ToString();
                }
                else
                {
                    this.txtPasswordMinLength.Text = string.Empty;
                }

                this.txtPasswordSpecialChars.Text = new string(pwdConfigurations.SpecialCharacters);

                if (pwdConfigurations.ExpirationEnabled && pwdConfigurations.ValidityDays > 0)
                {
                    this.txtPasswordValidityDays.Text = pwdConfigurations.ValidityDays.ToString();
                }
                else
                {
                    this.txtPasswordValidityDays.Text = string.Empty;
                }

                this.btnExpireAll.Attributes.Add("onclick", "return OnClickExpireAllPassword();");
            }
        }