Ejemplo n.º 1
0
        //public void Close()
        //{
        //    this.DialogResult = false;
        //}
        public void Regist()
        {
            if (IsRegiSuccess)
            {
                SetLoginSuccess();
                return;
            }
            else
            {
                if (string.IsNullOrEmpty(PassWord))
                {
                    WindowToolTip = "Please input a password";
                    return;
                }
                if (string.IsNullOrEmpty(RePassWord))
                {
                    WindowToolTip = "Please confirm your password";
                    return;
                }
                if (!string.Equals(PassWord, RePassWord))
                {
                    WindowToolTip = "The two passwords entered are inconsistent";
                    return;
                }
                else
                {
                    WindowToolTip = "OK!";
                }

                string preSalt        = Encryptor.GenerateSalt();
                string sufSalt        = Encryptor.GenerateSalt();
                string hashedPassword = Encryptor.SHA512AddSalt(preSalt, RePassWord, sufSalt);

                db.InsertMasterPw(MasterUserName, hashedPassword, preSalt, sufSalt);
                RegiBtnContent = "Close";
                IsRegiSuccess  = true;
                return;
            }
        }