std::string fuh::user_info(const std::string& name) { if(!user_exists(name)) { throw error("No user with the name '" + name + "' exists."); } time_t reg_date = get_registrationdate(name); time_t ll_date = get_lastlogin(name); std::string reg_string = ctime(®_date); std::string ll_string; if(ll_date) { ll_string = ctime(&ll_date); } else { ll_string = "Never\n"; } std::stringstream info; info << "Name: " << name << "\n" << "Registered: " << reg_string << "Last login: "******"This account is currently inactive.\n"; } return info.str(); }
std::string suh::user_info(const std::string& name) { if(!user_exists(name)) throw error("No user with the name '" + name + "' exists."); time_t reg_date = get_registrationdate(name); time_t ll_date = get_lastlogin(name); std::string reg_string = ctime(®_date); std::string ll_string = ctime(&ll_date); std::stringstream info; info << "Name: " << name << "\n" << "Real name: " << get_realname(name) << "\n" << "Registered: " << reg_string << "Last login: " << ll_string; return info.str(); }