-
Notifications
You must be signed in to change notification settings - Fork 0
/
clsLoginScreen.h
56 lines (48 loc) · 1.02 KB
/
clsLoginScreen.h
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
#pragma once
#include <iostream>
#include "clsScreen.h"
#include "Global.h"
#include "clsClientListScreen.h"
#include "clsMainScreen.h"
#include "clsUser.h"
using namespace std;
class clsLoginScreen : protected clsScreen
{
private:
static bool _Login()
{
bool IsLoginFailed = false;
string Password, UserName;
short Trail = 0;
do
{
if (IsLoginFailed)
{
Trail++;
cout << "\nInvalid Username/Password!";
cout << "\nYou have " << (3 - Trail) << " trails to login\n\n";
}
if (Trail == 3)
{
cout << "\nYour are Locked after 3 failed trails \n\n";
return false;
}
cout << "Enter Username?";
cin >> UserName;
cout << "Enter Password?";
cin >> Password;
CurrentUser = clsUser::Find(UserName, Password);
IsLoginFailed = CurrentUser.IsEmpty();
} while (IsLoginFailed);
CurrentUser.RegisterLogIn();
clsMainScreen::ShowMainMenu();
return true;
}
public:
static bool ShowLoginScreen()
{
system("cls");
_DrawMainScreenHeader("\t\t Login Screen");
return _Login();
}
};