|
|
@ -4,19 +4,11 @@ |
|
|
|
bool employeesAccess(char* employeesAccessCode) |
|
|
|
{ |
|
|
|
|
|
|
|
if(strcmp(employeesAccessCode,employeeAccessKey) == 0) |
|
|
|
{ |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
return !(strcmp(employeesAccessCode,employeeAccessKey)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
extern int checkEmployeeCredentials(char *inputUsername, char *inputPassword) |
|
|
|
int checkEmployeeCredentials(char *inputUsername, char *inputPassword) |
|
|
|
{ |
|
|
|
|
|
|
|
char* listUsername = malloc(credentialLength * sizeof(char*)); |
|
|
@ -55,44 +47,42 @@ extern int checkEmployeeCredentials(char *inputUsername, char *inputPassword) |
|
|
|
free(inputPassword); |
|
|
|
} |
|
|
|
|
|
|
|
void inputEmployeeAccessCode() |
|
|
|
void getEmployeeAccessCode() |
|
|
|
{ |
|
|
|
char accessKey[10]; |
|
|
|
char accessCode[10]; |
|
|
|
|
|
|
|
int remainingAttempts = 10; |
|
|
|
|
|
|
|
|
|
|
|
printf("\n\nPlease enter the Access key : "); |
|
|
|
// scanf("%s",accessKey); |
|
|
|
|
|
|
|
while(remainingAttempts>0) |
|
|
|
while(remainingAttempts > 0) |
|
|
|
{ |
|
|
|
scanf("%s",accessKey); |
|
|
|
scanf("%s",accessCode); |
|
|
|
|
|
|
|
if(employeesAccess(accessKey)==true) |
|
|
|
if(employeesAccess(accessCode)) |
|
|
|
{ |
|
|
|
printf("\n\nAccess granted!\n\n"); |
|
|
|
printf("\n\nAccess granted!\n\n"); |
|
|
|
|
|
|
|
loginAsEmployee(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
--remainingAttempts; |
|
|
|
printf("\n\nAccess key didnt match! try again !\n\n"); |
|
|
|
|
|
|
|
--remainingAttempts; |
|
|
|
} |
|
|
|
|
|
|
|
if(remainingAttempts == 0) |
|
|
|
{ |
|
|
|
printf("you've reached the maximum number of tries!\nplease contact an employee of a high clearance(2 or higher) \n\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void employeeCredentials(char* inputUsername,char* inputPassword) |
|
|
|
void getEmployeeCredentials(char* inputUsername,char* inputPassword) |
|
|
|
{ |
|
|
|
printf("Enter username: "); |
|
|
|
scanf("%s", inputUsername); |
|
|
@ -108,7 +98,7 @@ void loginAsEmployee() |
|
|
|
|
|
|
|
while(counter>0) |
|
|
|
{ |
|
|
|
employeeCredentials(username, password); |
|
|
|
getEmployeeCredentials(username, password); |
|
|
|
|
|
|
|
int checkCredentials = checkEmployeeCredentials(username,password); |
|
|
|
|
|
|
|