Example #1
0
	void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
	{
		const Anope::string &password = params[0];

		User *u = source.GetUser();
		Oper *o = source.nc->o;
		if (o == NULL)
		{
			source.Reply(_("No oper block for your nickname."));
			return;
		}

		if (o->GetPassword().empty())
		{
			source.Reply(_("Your oper block doesn't require logging in."));
			return;
		}

		if (u->HasExtOK("os_login"))
		{
			source.Reply(_("You are already logged in."));
			return;
		}

		if (o->GetPassword() != password)
		{
			source.Reply(_("Password incorrect."));
			u->BadPassword();
			return;
		}

		Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.service->nick;
		u->Extend<bool>("os_login", true);
		source.Reply(_("Password accepted."));
	}
Example #2
0
	void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
	{
		User *u = source.GetUser();
		Oper *o = source.nc->o;
		if (o == NULL)
		{
			source.Reply(_("No oper block for your nick."));
			return;
		}

		if (o->GetPassword().empty())
		{
			source.Reply(_("Your oper block doesn't require logging in."));
			return;
		}

		if (!u->HasExtOK("os_login"))
		{
			source.Reply(_("You are not identified."));
			return;
		}

		Log(LOG_ADMIN, source, this);
		u->ShrinkOK<bool>("os_login");
		source.Reply(_("You have been logged out."));
	}