Ejemplo n.º 1
0
	void OnFail(NickServ::IdentifyRequest *req) override
	{
		if (!client || !server)
			return;
		replacements["INVALID_LOGIN"] = "******";
		TemplateFileServer page("login.html");
		page.Serve(server, page_name, client, message, reply, replacements);

		client->SendReply(&reply);
	}
Ejemplo n.º 2
0
    void OnFail(NickServ::IdentifyRequest *req) override
    {
        if (!xinterface || !client)
            return;

        request.r = this->repl;

        request.reply("error", "Invalid password");

        xinterface->Reply(request);
        client->SendReply(&request.r);
    }
Ejemplo n.º 3
0
    void OnSuccess(NickServ::IdentifyRequest *req) override
    {
        if (!xinterface || !client)
            return;

        request.r = this->repl;

        request.reply("result", "Success");
        request.reply("account", req->GetAccount());

        xinterface->Reply(request);
        client->SendReply(&request.r);
    }
Ejemplo n.º 4
0
	void OnSuccess(NickServ::IdentifyRequest *req) override
	{
		if (!client || !server)
			return;
		::NickServ::Nick *na = ::NickServ::FindNick(req->GetAccount());
		if (!na)
		{
			this->OnFail(req);
			return;
		}

		if (na->GetAccount()->HasFieldS("NS_SUSPENDED"))
		{
			this->OnFail(req);
			return;
		}

		Anope::string id;
		for (int i = 0; i < 64; ++i)
		{
			char c;
			do
				c = 48 + (rand() % 75);
			while (!isalnum(c));
			id += c;
		}

		na->Extend<Anope::string>("webcpanel_id", id);
		na->Extend<Anope::string>("webcpanel_ip", client->GetIP());

		{
			HTTPReply::cookie c;
			c.push_back(std::make_pair("account", na->GetNick()));
			c.push_back(std::make_pair("Path", "/"));
			reply.cookies.push_back(c);
		}

		{
			HTTPReply::cookie c;
			c.push_back(std::make_pair("id", id));
			c.push_back(std::make_pair("Path", "/"));
			reply.cookies.push_back(c);
		}

		reply.error = HTTP_FOUND;
		reply.headers["Location"] = Anope::string("http") + (server->IsSSL() ? "s" : "") + "://" + message.headers["Host"] + "/nickserv/info";

		client->SendReply(&reply);
	}