@ -97,18 +97,18 @@ bool createNewEmployee(char* employeeId, char* employeePassword)
void getNewEmployeeCredentials ( )
{
const int employeeId Length = 21 ;
char employeeId [ employeeId Length] ;
const int Length = 21 ;
char employeeId [ Length ] ;
const int minimumPasswordLength = 5 ;
char employeePassword [ minimumPassword Length] ;
char employeePassword [ Length ] ;
char passwordVerfication [ Length ] ;
printf ( " please enter your wished Id : \n " ) ;
/*Added the regular expression [^\n] so that the string keep on getting read until a newline '\n' is found*/
scanf ( " %[^ \n ]s " , employeeId ) ;
employeeId [ employeeId Length] = ' \0 ' ;
employeeId [ Length ] = ' \0 ' ;
printf ( " \n please enter your wished Password : \n " ) ;
@ -116,20 +116,34 @@ void getNewEmployeeCredentials()
employeePassword [ strlen ( employeePassword ) ] = ' \0 ' ;
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 " ) ;
}
printf ( " \n please confirm your Password : \n " ) ;
scanf ( " %s " , passwordVerfication ) ;
passwordVerfication [ strlen ( employeePassword ) ] = ' \0 ' ;
else if ( isValidEmployeeID ( employeeId , employeeIdLength ) & & ! isValidPassword ( employeePassword , minimumPasswordLength ) )
if ( verifyPassword ( passwordVerfication , employeePassword ) )
{
printf ( " Error : the entered password should be at least 5 characters long and should contain at least 1 digit, 1 alphabet and 1 symbol! " ) ;
}
if ( isValidEmployeeID ( employeeId , Length ) & & 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 " ) ;
}
else if ( isValidEmployeeID ( employeeId , Length ) & & ! 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 symbol! " ) ;
}
else
{
printf ( " Error : the entered ID should contain a maximum of 20 letters " ) ;
}
}
else
{
printf ( " Error : the entered ID should contain a maximum of 20 letters " ) ;
printf ( " the Verification password and the entered password dont match " ) ;
}
}