Exemple #1
0
        private void butPassword_Click(object sender, System.EventArgs e)
        {
            bool             isCreate = UserCur.Password == "";
            FormUserPassword FormU    = new FormUserPassword(isCreate, UserCur.UserName);

            FormU.IsInSecurityWindow = true;
            FormU.ShowDialog();
            if (FormU.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            UserCur.Password = FormU.hashedResult;
            if (PrefC.GetBool(PrefName.PasswordsMustBeStrong))
            {
                UserCur.PasswordIsStrong = true;
            }
            if (UserCur.Password == "")
            {
                butPassword.Text = Lan.g(this, "Create Password");
            }
            else
            {
                butPassword.Text = Lan.g(this, "Change Password");
            }
        }
        private void butPassword_Click(object sender, System.EventArgs e)
        {
            bool             isCreate = UserCur.Password == "";
            FormUserPassword FormU    = new FormUserPassword(isCreate);

            FormU.ShowDialog();
            if (FormU.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            UserCur.Password = FormU.hashedResult;
            if (UserCur.Password == "")
            {
                butPassword.Text = Lan.g(this, "Create Password");
            }
            else
            {
                butPassword.Text = Lan.g(this, "Change Password");
            }
        }
Exemple #3
0
        ///<summary>Called to change the password for Security.CurUser.
        ///Returns true if password was changed successfully.
        ///Set isForcedLogOff to force the program to log the user off if they cancel out of the Change Password window.</summary>
        public static bool ChangePassword(bool isForcedLogOff, bool doRefreshSecurityCache = true)
        {
            //no security blocking because everyone is allowed to change their own password.
            if (Security.CurUser.UserNumCEMT != 0)
            {
                MsgBox.Show("FormOpenDental", "Use the CEMT tool to change your password.");
                return(false);
            }
            FormUserPassword FormU = new FormUserPassword(false, Security.CurUser.UserName);

            FormU.ShowDialog();
            if (FormU.DialogResult == DialogResult.Cancel)
            {
                if (isForcedLogOff)
                {
                    FormOpenDental FormOD = Application.OpenForms.OfType <FormOpenDental>().ToList()[0];                 //There always should be exactly 1.
                    FormOD.LogOffNow(true);
                }
                return(false);
            }
            bool isPasswordStrong = FormU.PasswordIsStrong;

            try {
                Userods.UpdatePassword(Security.CurUser, FormU.LoginDetails, isPasswordStrong);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return(false);
            }
            Security.CurUser.PasswordIsStrong = FormU.PasswordIsStrong;
            Security.CurUser.LoginDetails     = FormU.LoginDetails;
            Security.PasswordTyped            = FormU.PasswordTyped;
            if (doRefreshSecurityCache)
            {
                DataValid.SetInvalid(InvalidType.Security);
            }
            return(true);
        }
Exemple #4
0
        private void butPassword_Click(object sender, System.EventArgs e)
        {
            bool             isCreate = string.IsNullOrEmpty(UserCur.PasswordHash);
            FormUserPassword FormU    = new FormUserPassword(isCreate, UserCur.UserName);

            FormU.IsInSecurityWindow = true;
            FormU.ShowDialog();
            if (FormU.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            UserCur.LoginDetails     = FormU.LoginDetails;
            UserCur.PasswordIsStrong = FormU.PasswordIsStrong;
            _passwordTyped           = FormU.PasswordTyped;
            if (string.IsNullOrEmpty(UserCur.PasswordHash))
            {
                butPassword.Text = Lan.g(this, "Create Password");
            }
            else
            {
                butPassword.Text = Lan.g(this, "Change Password");
            }
        }
Exemple #5
0
 //File
 private void menuItemPassword_Click(object sender,EventArgs e)
 {
     //no security blocking because everyone is allowed to change their own password.
     FormUserPassword FormU=new FormUserPassword(false,Security.CurUser.UserName);
     FormU.ShowDialog();
     if(FormU.DialogResult==DialogResult.Cancel) {
         return;
     }
     Security.CurUser.Password=FormU.hashedResult;
     if(PrefC.GetBool(PrefName.PasswordsMustBeStrong)) {
         Security.CurUser.PasswordIsStrong=true;
     }
     Userods.Update(Security.CurUser);
     DataValid.SetInvalid(InvalidType.Security);
 }
Exemple #6
0
		private void butPassword_Click(object sender, System.EventArgs e) {
			bool isCreate=UserCur.Password=="";
			FormUserPassword FormU=new FormUserPassword(isCreate,UserCur.UserName);
			FormU.IsInSecurityWindow=true;
			FormU.ShowDialog();
			if(FormU.DialogResult==DialogResult.Cancel){
				return;
			}
			UserCur.Password=FormU.HashedResult;
			if(PrefC.GetBool(PrefName.PasswordsMustBeStrong)) {
				UserCur.PasswordIsStrong=true;
			}
			if(UserCur.Password==""){
				butPassword.Text=Lan.g(this,"Create Password");
			}
			else{
				butPassword.Text=Lan.g(this,"Change Password");
			}
		}