Password Restrictions and storing data

Hi there I'm trying to create a piece of code similar to the code I have created on the new username section which will allow me to put certain restrictions on how my new users log in i.e the password length and the the need for a numeric digit. I also need some help storing my new members details in my previously created array. Could anyone point me in the right direction on how to solve this. Thanks

case 'N': //Set up new user
Console.Write("\n\tCreate new Member details \n");

Console.Write("\n\tCreate new Username\n\t must be 8 characters, all letters, 1 Capital letter");
do
{
numCaps = 0;
//must be 8 characters long, all letters 1 Capital letter
Console.Write("\n\tPlease enter your new Username with 8 characters = ");
newUser = Console.ReadLine();

//loop to check word is all letters
userAllLetters = true;
foreach (char newChar in newUser)
{
if (Char.IsLetter(newChar) == false)
userAllLetters = false;
//check if character is in the ASCII range A-Z 65-90
charASCII = Convert.ToInt16(newChar);
if ((charASCII >= 65) && (charASCII <= 90))
numCaps++; //Add 1 to number of capital letters

}//loop to look at each character in word
if (userAllLetters == false)
Console.WriteLine("The new word contains characters other than letters");
if (numCaps != 1)
Console.WriteLine("You entered {0} capital letters, you must use exactly one", numCaps);

MinLengthPass = true;
foreach (char newChar in newPass)
{

}

} while ((newUser.Length != 8) || (userAllLetters == false) || (numCaps != 1));

userName[numWords] = newUser;
numWords++;

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories