From 2ca00fa585087f2097796d994d378708041a7194 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 20 Nov 2011 20:16:15 +0100 Subject: Fix processing of the default_password setting. It is now actually used as the plaintext password for new users. Also add /setpassword and /clearpassword server commands that can be used by admins with the PRIV_PASSWORD privilege, and update the /help message. --- src/servercommand.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'src/servercommand.cpp') diff --git a/src/servercommand.cpp b/src/servercommand.cpp index afd704fd3..d971b18a0 100644 --- a/src/servercommand.cpp +++ b/src/servercommand.cpp @@ -281,6 +281,54 @@ void cmd_banunban(std::wostringstream &os, ServerCommandContext *ctx) } } +void cmd_setclearpassword(std::wostringstream &os, + ServerCommandContext *ctx) +{ + if((ctx->privs & PRIV_PASSWORD) == 0) + { + os<parms[0] == L"setpassword") + { + if(ctx->parms.size() != 3) + { + os<parms[1]); + password = ctx->parms[2]; + + actionstream<player->getName()<<" sets password of " + <parms.size() != 2) + { + os<parms[1]); + password = L""; + + actionstream<player->getName()<<" clears password of" + <server->setPlayerPassword(playername, password); + + os<parms.size() == 0 || ctx->parms[0] == L"help") { os<parms[0] == L"status") cmd_status(os, ctx); @@ -350,6 +400,8 @@ std::wstring processServerCommand(ServerCommandContext *ctx) cmd_teleport(os, ctx); else if(ctx->parms[0] == L"ban" || ctx->parms[0] == L"unban") cmd_banunban(os, ctx); + else if(ctx->parms[0] == L"setpassword" || ctx->parms[0] == L"clearpassword") + cmd_setclearpassword(os, ctx); else if(ctx->parms[0] == L"me") cmd_me(os, ctx); else if(ctx->parms[0] == L"clearobjects") -- cgit v1.2.3