Exemplo n.º 1
0
Admin AdminService::GetParasFRomJson(string jsonString){
	Json::Reader reader;
		Json::Value root;
		Admin admin;
		if(reader.parse(jsonString,root)){
			admin.setOp(root["m_op"].asString());
			admin.setPsd(root["a_psd"].asString());
			admin.setId(root["a_id"].asString());
			admin.setPriority(root["a_priority"].asString());
			admin.setName(root["a_name"].asString());
		}
		return admin;
}
void Credentials_Analyzer::InputPassword( Admin &a, Surfer &s)
{
	string str="", nstr="";
	cout << "\nEnter your name: ";
	fflush(stdin);
	getline(cin, nstr);
	s.setName(nstr);
	a.setName(nstr);
	cout << "\nEnter your unique 5 characters long password(you won't see it!): " << endl;
	HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
	DWORD mode = 0;
	GetConsoleMode(hStdin, &mode);
	SetConsoleMode(hStdin, mode & (~ENABLE_ECHO_INPUT));//Hide what is entered
	fflush(stdin);
	getline(cin, str);
	SetConsoleMode(hStdin, mode);//Echo now what is entered 
	Check_Admin(str, a, s);
	Check_Surfer(str, s,a);
}