Browse Source

implement the isValidPassword() function in the getNewEmployeeCredentials() function in order to check the validity of the entered password.

remotes/origin/feature/employees-infos-access
fdai7207 2 years ago
parent
commit
39fce8d436
  1. 9
      src/createEmployeeAccount.c

9
src/createEmployeeAccount.c

@ -105,14 +105,19 @@ void getNewEmployeeCredentials()
employeePassword[strlen(employeePassword)] = '\0'; employeePassword[strlen(employeePassword)] = '\0';
if(isValidEmployeeID(employeeId,employeeIdLength))
if(isValidEmployeeID(employeeId,employeeIdLength) && isValidPassword(employeePassword,minimumPasswordLength))
{ {
createNewEmployee(employeeId,employeePassword) ? printf("\n\n Account created successfully !\n\n") : printf("\n\n Could not create the Account please contact an employee of clearance 1 !\n\n"); createNewEmployee(employeeId,employeePassword) ? printf("\n\n Account created successfully !\n\n") : printf("\n\n Could not create the Account please contact an employee of clearance 1 !\n\n");
} }
else if(isValidEmployeeID(employeeId,employeeIdLength) && !isValidPassword(employeePassword,minimumPasswordLength))
{
printf("Error : the entered password should be at least 5 characters long and should contain at least 1 digit, 1 alphabet and 1 punctuation character!");
}
else else
{ {
printf("Error : the entered ID either contains space or exceeds the maximum of 20 characters!");
printf("Error : the entered ID should contain a maximum of 20 letters");
} }
} }

Loading…
Cancel
Save