diff --git a/build-script.sh b/build-script.sh index 34cdd7c..017874a 100755 --- a/build-script.sh +++ b/build-script.sh @@ -2,7 +2,7 @@ clear ceedling test:all rm -r build cd src/ -gcc helperFunctions.c error.c loginCustomer.c createCustomer.c mainMenu.c program.c -lm -o program.out +gcc helperFunctions.c error.c loginCustomer.c customerMenu.c createCustomer.c mainMenu.c program.c -lm -o program.out ./program.out rm program.out cd .. diff --git a/src/customerMenu.c b/src/customerMenu.c index 20bc709..436a4c3 100644 --- a/src/customerMenu.c +++ b/src/customerMenu.c @@ -56,11 +56,10 @@ void showAllMenuEntries() void menu(customer_t *c) { if(c==NULL){ - puts("Invalid pointer. Aborting.\n"); + puts("Invalid pointer. Aborting!"); exit(-1); }else{ - printf("Welcome %s %s!\n",c->forename, c->surname); - printf("Balance: %.4f€\n",c->balance); + puts("Welcome!"); showAllMenuEntries(); } } diff --git a/src/error.c b/src/error.c index 26821c1..481d268 100644 --- a/src/error.c +++ b/src/error.c @@ -17,7 +17,7 @@ int errorMessage(int errorCode) returnValue = -3; break; case -4: - puts("CustomerData.* not found. Make sure that you've created an user account before logging in for the first time. Without users there is no file. Aborting!"); + puts("CustomerData.* not found. Make sure that you've created an user account before logging in for the first time. Without users there is no file. Aborting!"); returnValue = -4; break; case -5: diff --git a/src/loginCustomer.c b/src/loginCustomer.c index f06873c..f466181 100644 --- a/src/loginCustomer.c +++ b/src/loginCustomer.c @@ -44,8 +44,9 @@ void collectCustomerDataForLogin(int attempts) bool loginSuccessful = loginCustomer(&c); free(c.IDAsString); free(c.password); - if(loginSuccessful ) { - printf("Welcome!\n"); + if(loginSuccessful) { + //call menu(); + menu(&c); }else if(!loginSuccessful && attempts < MAX_LOGIN_ATTEMPTS){ printf("You have %d attempts left.\n", MAX_LOGIN_ATTEMPTS - attempts); collectCustomerDataForLogin(++attempts); diff --git a/src/loginCustomer.h b/src/loginCustomer.h index 251e0d9..e126f86 100644 --- a/src/loginCustomer.h +++ b/src/loginCustomer.h @@ -5,6 +5,7 @@ #include #include #include "createCustomer.h" +#include "customerMenu.h" #include "error.h" #define MAX_LOGIN_ATTEMPTS 3 bool checkLogin(bool); diff --git a/test/test_LoginCustomer.c b/test/test_LoginCustomer.c index 61a7a75..a3f945b 100644 --- a/test/test_LoginCustomer.c +++ b/test/test_LoginCustomer.c @@ -1,5 +1,6 @@ #include #include "../src/loginCustomer.c" +#include "../src/customerMenu.c" #include "../src/helperFunctions.c" #include "../src/error.c" void setUp(){};