コード例 #1
0
ファイル: FormUserEdit.cs プロジェクト: nampn/ODental
        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");
            }
        }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
ファイル: SecurityL.cs プロジェクト: ChemBrain/OpenDental
        ///<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);
        }
コード例 #4
0
ファイル: FormUserEdit.cs プロジェクト: ChemBrain/OpenDental
        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");
            }
        }
コード例 #5
0
ファイル: FormOpenDental.cs プロジェクト: nampn/ODental
 //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);
 }
コード例 #6
0
ファイル: FormUserEdit.cs プロジェクト: mnisl/OD
		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");
			}
		}