private void HandleRegisterCommand(object parameter)
        {
            var passwordBox = parameter as PasswordBox;
            var password    = passwordBox.Password;
            //SHA1 sha = new SHA1CryptoServiceProvider();
            //var passwordBytes = Encoding.Default.GetBytes(password);
            //passwordBytes = Encoding.Convert(Encoding.Default,Encoding.UTF8,passwordBytes);
            //var authenticationCodeBytes = sha.ComputeHash(passwordBytes);
            //var authenticationCode = Encoding.UTF8.GetString(authenticationCodeBytes);

            var authenticationCode = this.GetSHA1HashData(password);

            try
            {
                DataPersister.RegisterUser(this.Username, this.Email, authenticationCode);
                this.HandleLoginCommand(parameter);
            }
            catch (ArgumentException argEx)
            {
                this.Message = argEx.Message;
            }
            catch (Exception ex)
            {
                this.Message = ex.Message;
            }
        }
        private void HandleRegisterCommand(object parameter)
        {
            var passwordBox        = parameter as PasswordBox;
            var password           = passwordBox.Password;
            var authenticationCode = this.GetSha1HashData(password);

            bool isRegistered = DataPersister.RegisterUser(this.Username, this.Email, authenticationCode);

            if (isRegistered)
            {
                this.HandleLoginCommand(parameter);
            }
        }
        private void HandleRegisterCommand(object parameter)
        {
            var passwordBox = parameter as PasswordBox;
            var password    = passwordBox.Password;

            //TODO:SHA1
            #region TODO:SHA1
            //SHA1 sha = new SHA1CryptoServiceProvider();
            //var passwordBytes = Encoding.Default.GetBytes(password);
            //passwordBytes = Encoding.Convert(Encoding.Default,Encoding.UTF8,passwordBytes);
            //var authenticationCodeBytes = sha.ComputeHash(passwordBytes);
            //var authenticationCode = Encoding.UTF8.GetString(authenticationCodeBytes);
            #endregion

            var authenticationCode = this.GetSHA1HashData(password);

            DataPersister.RegisterUser(this.RegUsername, this.DisplayName, this.Email, this.Phone, this.Location, authenticationCode);
            this.HandleLoginRegisterCommand(parameter);
        }
示例#4
0
        private void HandleRegisterCommand(object parameter)
        {
            var passwordBox = parameter as PasswordBox;
            var password    = passwordBox.Password;

            var authenticationCode = this.GetSHA1HashData(password);

            try
            {
                DataPersister.RegisterUser(this.Username, this.Email, authenticationCode);
                this.HandleLoginCommand(parameter);
            }
            catch (ArgumentException argEx)
            {
                this.Message = argEx.Message;
            }
            catch (Exception ex)
            {
                this.Message = ex.Message;
            }
        }