예제 #1
0
        public bool Ok(IDataPipe pipe, string password, string confirmation)
        {
            var success = true;

            if (password != confirmation)
            {
                pipe.WriteLine("The passwords don't match");
                success = false;
            }
            if (password.Length < 8)
            {
                pipe.WriteLine("Password must be at least 8 characters in length");
                success = false;
            }
            return(success);
        }
예제 #2
0
        public void CreateUser()
        {
            _pipe.WriteLine("Enter a username");
            var username = _pipe.Readline();

            _pipe.WriteLine("Enter your full name");
            var fullName = _pipe.Readline();

            _pipe.WriteLine("Enter your password");
            var password = _pipe.Readline();

            _pipe.WriteLine("Re-enter your password");
            var confirmedPassword = _pipe.Readline();

            if (!_validator.Ok(_pipe, password, confirmedPassword))
            {
                return;
            }

            _pipe.WriteLine($"Saving Details for User ({username}, {fullName}, {_cypher.Encrypt(password)})\n");
        }