-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
139 lines (115 loc) · 3.79 KB
/
main.cpp
File metadata and controls
139 lines (115 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include <iostream>
#include <fstream>
#include <windows.h>
#include "cifrador.h"
#include "User.h"
#include<vector>
using namespace std;
void pause()
{
cout << " Presiona [ENTER] para continuar..." ;
cin.ignore();
}
int main()
{
Cifrador cfr;
User usrs[40];
int global=0;
int op=0;
while(op!=3)
{
string data;
cout << "*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~" << endl << endl;
cout << "\t\t\t| Login Test |" << endl << endl;
cout << "*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~" << endl << endl;
cout << "\t\tMENU PRINCIPAL" << endl << endl;
cout << "\t[1] Iniciar Sesion " << endl;
cout << "\t[2] Crear nuevo usuario" << endl;
cout << "\t[3] SALIR " << endl << endl;
cout << "*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~" << endl << endl;
cout << "\tElija una opcion: ";
cin >> op;
cin.ignore();
cout << endl;
string u,p,q;
switch(op)
{
case 1:
cout << "Usuario: ";
cin >> u;
cout << "Contraseña: ";
cin >> p;
p = cfr.encripta(p);
int j;
for(j=0;j<40;j++)
{
if(usrs[j].getName()==u)
{
if(usrs[j].getBrute() > 0)
{
if(usrs[j].getPassHash() == p)
{
cout << "Esta es tu informacion: " << usrs[j].getInfo();
}
else
{
cout << "Contraseña incorrecta" ;
usrs[j].decBrute();
}
}
else if(usrs[j].getBrute() > -1)
{
cout << "ESTA ES LA ULTIMA OPORTUNIDAD QUE TIENES PARA ENTRAR Y YA NO SE PODRA INGRESAR A ESTA CUENTA" << endl;
cout << "¿Cual es tu cancion o pelicula favorita?: ";
cin >> q;
if(usrs[j].isValidQS(q))
{
cout << "Esta es tu informacion, ya no sera mas accesible: " << usrs[j].getInfo();
usrs[j].decBrute();
}
else
{
cout << "Respuesta incorrecta" ;
usrs[j].decBrute();
}
}
else
{
cout << "Cuenta bloqueada";
}
break;
}
else if(j==39)
{
cout << "Usuario no encontrado";
}
}
break;
case 2:
cout << "Dame el nombre de usuario: ";
cin >> data;
usrs[global].setName(data);
cout << "Ingresa tu contraseña: ";
cin >> data;
usrs[global].setPassword(data);
cout << "Ingresa tu informacion confidencial: ";
cin >> data;
usrs[global].setInfo(data);
cout << "¿Cual es tu cancion o pelicula favorita?: ";
cin >> data;
usrs[global].setQS(data);
break;
case 3:
cout << "Saliendo..." << endl;
break;
default:
cout << "Opcion Invalida!" << endl;
break;
}
cout << endl;
fflush(stdin);
pause();
system("cls");
}
return 0;
}