Anope IRC Services  Version 2.0
confirm.cpp
Go to the documentation of this file.
1 /*
2  * (C) 2003-2014 Anope Team
3  * Contact us at team@anope.org
4  *
5  * Please read COPYING and README for further details.
6  */
7 
8 #include "../webcpanel.h"
9 
10 bool WebCPanel::Confirm::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply)
11 {
13  const Anope::string &user = message.post_data["username"], &pass = message.post_data["password"], &email = message.post_data["email"];
14 
15  replacements["TITLE"] = page_title;
16 
17  if (!user.empty() && !pass.empty())
18  {
19  std::vector<Anope::string> params;
20  params.push_back(pass);
21  if (!email.empty())
22  params.push_back(email);
23 
24  WebPanel::RunCommand(user, NULL, "NickServ", "nickserv/register", params, replacements);
25  }
26 
27  TemplateFileServer page("confirm.html");
28 
29  page.Serve(server, page_name, client, message, reply, replacements);
30  return true;
31 }
32 
void Serve(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &, Replacements &)
void push_back(char c)
Definition: anope.h:142
bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_override
Definition: confirm.cpp:10
void RunCommand(const Anope::string &user, NickCore *nc, const Anope::string &service, const Anope::string &c, const std::vector< Anope::string > &params, TemplateFileServer::Replacements &r, const Anope::string &key)
Definition: webcpanel.cpp:234
bool empty() const
Definition: anope.h:126
std::map< Anope::string, Anope::string > post_data
Definition: httpd.h:81
Anope::string page_title
Definition: webcpanel.cpp:11