Advertisement
Guest User

Untitled

a guest
Sep 14th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. int main(){
  2.  
  3.     string input = "";
  4.     string password;
  5.     string userClearance;
  6.     string directory;
  7.  
  8.     remenu:
  9.  
  10.     getline(cin, input);
  11.  
  12.     if(input.compare("FileSystem -i") == 0){
  13.         cout << "Username: ";
  14.         cin >> input;
  15.         userRegistration(input);
  16.         goto remenu;
  17.     }
  18.     else if(input.compare("FileSystem") == 0){
  19.         fileInitializer();
  20.         reLogin:
  21.         cout << "Username: ";
  22.         cin >> input;
  23.         cout << "Password:";
  24.         char ch = _getch();
  25.         while(ch != 13){//character 13 is enter
  26.           password.push_back(ch);
  27.           ch = _getch();
  28.         }
  29.         cout << endl;
  30.  
  31.         if(userAuthentication(input, password, directory, userClearance)){
  32.             displayMenu(stoi(userClearance));
  33.         }
  34.         else{
  35.             cout << "Invalid username or password" << endl;
  36.             reCaptcha:
  37.             //captcha generation
  38.             string captcha = generateCaptcha(9);
  39.             cout << captcha;
  40.  
  41.             // Ask user to enter a CAPTCHA
  42.             string usr_captcha;
  43.             cout << "\nEnter above CAPTCHA: ";
  44.             cin >> usr_captcha;
  45.  
  46.             // Notify user about matching status
  47.             if (checkCaptcha(captcha, usr_captcha)){
  48.                 cout << "\nCAPTCHA Matched" << endl;
  49.                 goto reLogin;
  50.             }
  51.             else{
  52.                 cout << "\nCAPTCHA Not Matched" << endl;
  53.                 goto reCaptcha;
  54.             }
  55.         }
  56.         cin.clear();
  57.         cin.ignore(1000, '\n');
  58.         goto remenu;
  59.     }
  60.     else{
  61.         cout << "Unknown command entered, please try again" << endl;
  62.         goto remenu;
  63.     }
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement