Untitled
unknown
plain_text
5 months ago
2.3 kB
3
Indexable
#pragma once #include <iostream> #include "clsScreen.h" #include "clsUser.h" #include "clsInputValidate.h" #include "Global.h" #include <iomanip> #include "clsMainScreen.h" #include "clsDate.h" class clsLoginScreen : protected clsScreen { private: //static string _ConvertUserRecordToLine(clsUser User, string Seperator = "#//#") /*My SOLUTION*/ //{ // string UserRecord = ""; // UserRecord += clsDate::DateToString(clsDate()) + Seperator; // UserRecord += CurrentUser.UserName + Seperator; // UserRecord += CurrentUser.Password + Seperator; // UserRecord += to_string(CurrentUser.Permissions); // return UserRecord; //} //static void _RegisterUserInLogFile() /*My SOLUTION*/ //{ // fstream MyFile; // MyFile.open("LoginRegister.txt", ios::out | ios::app); // if (MyFile.is_open()) // { // string stDataLine = _ConvertUserRecordToLine(CurrentUser); // MyFile << stDataLine << endl; // MyFile.close(); // } //} static bool _Login() { bool LogInFaild = false; short FaildLoginCount = 0; string UserName, Password; do { if (LogInFaild) { FaildLoginCount++; cout << "\nInvlaid Username/Password!\n\n"; cout << "\nYou have " << (3 - FaildLoginCount) << " Trial(s) to login.\n\n"; } if (FaildLoginCount == 3) { cout << "\nYour are Locked after 3 faild trails \n\n"; return false; } cout << "Enter Username? "; cin >> UserName; cout << "Enter Password? "; cin >> Password; CurrentUser = clsUser::Find(UserName, Password); LogInFaild = CurrentUser.IsEmpty(); } while (LogInFaild); /*_RegisterUserInLogFile(); */ /*My SOLUTION*/ CurrentUser.RegisterLogIn(); /* Abo Hadhoud Solution*/ clsMainScreen::ShowMainMenue(); //*first call stack final it then countinue* (in clsMainScreen(95)) return true; } void _Log() { } public: static bool ShowLoginScreen() { system("cls"); _DrawScreenHeader("\t Login Screen"); return _Login(); } };
Editor is loading...
Leave a Comment