add method for add user

This commit is contained in:
xiongziliang 2017-05-05 21:29:12 +08:00
parent e91525e96e
commit 56078f3ba0
2 changed files with 4 additions and 1 deletions

View File

@ -161,6 +161,7 @@ inline void ShellSession::sendHead() {
inline bool ShellSession::authUser(const string& user, const string& pwd) {
auto it = g_mapUser.find(user);
if (it == g_mapUser.end()) {
//WarnL << user << " " << pwd;
return false;
}
return it->second == pwd;

View File

@ -28,7 +28,9 @@ public:
void onRecv(const Socket::Buffer::Ptr &) override;
void onError(const SockException &err) override;
void onManager() override;
static void addUser(const string &userName,const string &userPwd){
g_mapUser[userName] = userPwd;
}
private:
friend class CMD_help;
inline bool onProcessLine(const string &);