Mise à jour

doc
Rémi LAVERGNE 1 year ago
parent 07979c05dd
commit 882fb79be4

@ -1,2 +1,2 @@
1313 12.1 0 0 1313 11 12.1 0 0
2010 12.1 0 0 2010 22 12.1 0 0

@ -42,6 +42,9 @@ void errorHandling(int error)
case -8: case -8:
printf("[ERREUR] - La référence existe déjà.\n"); printf("[ERREUR] - La référence existe déjà.\n");
break; break;
case -9:
printf("[ERREUR] - Le mot de passe est incorrect.\n");
break;
default: default:
printf("[ERREUR] - Une erreur s'est produite.\n"); printf("[ERREUR] - Une erreur s'est produite.\n");
break; break;

@ -23,9 +23,8 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog)
printf("Erreur, l'identifiant n'existe pas, entrez votre identifiant: "); printf("Erreur, l'identifiant n'existe pas, entrez votre identifiant: ");
scanf("%d%*c", &id); scanf("%d%*c", &id);
if (id == 0) if (id == 0)
{
return -1; return -1;
}
// Nombre de tentatives restantes // Nombre de tentatives restantes
tentative--; tentative--;
if (tentative == 0) if (tentative == 0)
@ -59,8 +58,8 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog)
} }
else else
{ {
printf("Erreur, le mot de passe est incorrect.\n"); errorHandling(-9);
return -1; return -9;
} }
} }
@ -90,16 +89,19 @@ int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended
scanf("%d%*c", &password); scanf("%d%*c", &password);
while (password < 0) while (password < 0)
{ {
errorHandling(-6);
printf("Erreur, le mot de passe doit être positif, entrez votre mot de passe: "); printf("Erreur, le mot de passe doit être positif, entrez votre mot de passe: ");
scanf("%d%*c", &password); scanf("%d%*c", &password);
} }
clientPassword[*tlog] = encrypt(password); //! Ne pas oublier de décaler vers la droite
clientPassword[index] = encrypt(password);
clientID[*tlog] = id; clientID[index] = id;
cagnotte[*tlog] = 0; cagnotte[index] = 0;
suspended[*tlog] = 0; suspended[index] = 0;
isAdmin[*tlog] = 0; isAdmin[index] = 0;
*tlog ++; *tlog++;
return 0; return 0;
} }

@ -86,13 +86,13 @@ void global(void)
status = signup(clientID, clientPassword, cagnotte, suspended, isAdmin, &tLogClient); status = signup(clientID, clientPassword, cagnotte, suspended, isAdmin, &tLogClient);
if(status == 0) if(status == 0)
{ {
printf("Inscription réussie.\nRetour au menu principal...\n"); printf("Inscription réussie, vous pouvez vous connecter.\nRetour au menu principal...\n");
sleep(3); sleep(2);
} }
else else
{ {
printf("Inscription échouée.\nRetour au menu principal...\n"); printf("Inscription échouée.\nRetour au menu principal...\n");
sleep(3); sleep(2);
} }
break; break;
case 3: case 3:
@ -100,6 +100,7 @@ void global(void)
//opposition(); //opposition();
break; break;
case 4: case 4:
sauvegardeDonnees(tLogArticle, tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, isAdmin, suspended);
return; return;
case 9: case 9:
debugMenu(reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin, tLogArticle, tLogClient); debugMenu(reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin, tLogArticle, tLogClient);

Loading…
Cancel
Save