Browse Source

implement the isValidEmployeeID() in the getNewEmployeeCredentials to check Id's validity

remotes/origin/feature/employees-infos-access
fdai7207 2 years ago
parent
commit
fed4a0a3ad
  1. 29
      src/createEmployeeAccount.c

29
src/createEmployeeAccount.c

@ -53,15 +53,32 @@ bool createNewEmployee(char* employeeId, char* employeePassword)
void getNewEmployeeCredentials()
{
char newEmployeeId[20];
char newEmployeePassword[20];
int newEmployeeIdlength = 21;
char newEmployeeId[newEmployeeIdlength];
char newEmployeePassword[newEmployeeIdlength];
printf("please enter your wished Id :\n");
scanf(" %[^\n]s",newEmployeeId);
newEmployeeId[newEmployeeIdlength] = '\0';
printf("\nplease enter your wished Password :\n");
printf("please enter your wished Id :");
scanf("%s",newEmployeeId);
printf("please enter your wished Password :");
scanf("%s",newEmployeePassword);
createNewEmployee(newEmployeeId,newEmployeePassword) ? 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");
newEmployeePassword[newEmployeeIdlength] = '\0';
if(isValidEmployeeID(newEmployeeId,newEmployeeIdlength))
{
createNewEmployee(newEmployeeId,newEmployeePassword) ? 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
{
printf("Error : the entered ID either contains space or exceeds the maximum of 20 characters!");
}
}
Loading…
Cancel
Save