// // identify_user.cc for marvin_gui in /home/castor/epita/marvin_gui // // Made by C@stor // Login // // Started on Wed Aug 27 20:48:12 2003 C@stor // Last update Wed Sep 10 00:18:32 2003 C@stor // #include #include #include "user.hh" #include "misc.hh" #include "language/language.hh" int check_password(std::string password) { std::string answer; int tentative = 0; // entre mdp et vérifie do { std::cout << ENTERPASSWORD; answer = get_stdin(); std::cout << std::endl; if (answer.compare(password) == 0) return 0; tentative++; } while (tentative < 3); return 1; } int c_list_user::identify_user() { std::string answer; unsigned int tmp = 255; // choisi utilisateur dans la liste do { print_list(); std::cout << std::endl << WHICHUSER; answer = get_stdin(); std::cout << std::endl; tmp = atoi(answer.c_str()); // std::cout << "#" << tmp << "#" << std::endl; } while (tmp > (_list_user.size() - 1)); if (check_password(_list_user[tmp]->get_password()->get_passphrase())) return 1; return 0; }