using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CMS.FormControls; using CMS.GlobalHelper; public partial class CMSModules_Membership_FormControls_Passwords_EncryptedPassword : FormEngineUserControl { #region "Constants" private const string hiddenPassword = "********"; #endregion #region "Private properties" /// /// Crypted password. /// private string CryptedPassword { get { return ValidationHelper.GetString(ViewState["CryptedPassword"], string.Empty); } set { ViewState["CryptedPassword"] = value; } } #endregion #region "Properties" /// /// Returns encrypted password. /// public override object Value { get { if (string.IsNullOrEmpty(txtPassword.Text)) { txtPassword.Attributes.Add("value", string.Empty); return string.Empty; } if (txtPassword.Text == hiddenPassword) { return CryptedPassword; } txtPassword.Attributes.Add("value", hiddenPassword); return EncryptionHelper.EncryptData(txtPassword.Text); } set { CryptedPassword = ValidationHelper.GetString(value, string.Empty); if (!string.IsNullOrEmpty(CryptedPassword)) { txtPassword.Attributes.Add("value", hiddenPassword); } else { txtPassword.Attributes.Add("value", string.Empty); } } } /// /// Indicates whether control is enabled. /// public override bool Enabled { get { return txtPassword.Enabled; } set { txtPassword.Enabled = value; } } /// /// Gets or sets max length. /// public int MaxLength { get { return txtPassword.MaxLength; } set { txtPassword.MaxLength = value; } } #endregion }