Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void UserPrompts()
- {
- char enteredId[32];
- char enteredPw[12];
- char hashedPW[32];
- int n = 5;
- int attempts = 0;
- int size = 60;
- // Get user input
- printf("Input User ID: ");
- fgets(enteredId, 32, stdin);
- usrNameValidity(enteredId);
- // Clean out new input so it matches perfectly with what's in the array
- enteredId[strcspn(enteredId, "\r\n")] = '\0';
- //User = malloc(sizeof(User) * size); // Allows up to 60 users (fixed size)
- for (int i=0;i<size;i++)
- {
- if (strcmp(enteredId,user[i].Id) == 0) //strcmp(pw1,pw2) == 0 //
- {
- int location = i;
- printf("ID found\n");
- PasswordCreation(location);
- }
- }
- printf("INVALID, ID NOT FOUND! ");
- userCreation();
- }
- void PasswordCreation(int location)
- {
- int n = 5;
- int i = location;
- int attempts = 0;
- int size = 60;
- char enteredId[32];
- char enteredPw [13];
- //char hashedPW[32];
- char ahashedPW[13];
- //while(attempts < n)
- //{
- printf("\n Enter password: ");
- fgets(enteredPw,13,stdin); // might need the same fix as above
- //passwordChecker(enteredPw);
- passwordHasher(enteredPw, ahashedPW);
- printf("%s", ahashedPW);
- printf("\n%s", user[i].hashPW);
- if (!(strcmp(ahashedPW, user[i].hashPW) == 0))
- {
- printf("\nEnter New Password: ");
- fgets(enteredPw,12,stdin);
- passwordChecker(enteredPw);
- passwordHasher(enteredPw, ahashedPW);
- strcpy(user[i].hashPW, ahashedPW);
- fileRepop();
- printf("your password has been changed");
- attempts = n;
- }
- attempts ++;
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement