From 56078f3ba01cb374232696caef1967ff090eb62d Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 5 May 2017 21:29:12 +0800 Subject: [PATCH] add method for add user --- src/Shell/ShellSession.cpp | 1 + src/Shell/ShellSession.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Shell/ShellSession.cpp b/src/Shell/ShellSession.cpp index 7e78eb8c..9d25c809 100644 --- a/src/Shell/ShellSession.cpp +++ b/src/Shell/ShellSession.cpp @@ -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; diff --git a/src/Shell/ShellSession.h b/src/Shell/ShellSession.h index cadec641..55923e5e 100644 --- a/src/Shell/ShellSession.h +++ b/src/Shell/ShellSession.h @@ -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 &);