| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | #include "authn.hh" |
|---|
| 21 | #include "error_resource.hh" |
|---|
| 22 | #include "redir_resource.hh" |
|---|
| 23 | #include "request.hh" |
|---|
| 24 | #include "templated_resource.hh" |
|---|
| 25 | #include "response.hh" |
|---|
| 26 | #include "token.hh" |
|---|
| 27 | |
|---|
| 28 | #include "../config.hh" |
|---|
| 29 | #include "../db/db.hh" |
|---|
| 30 | #include "../db/user.hh" |
|---|
| 31 | #include "../html/util.hh" |
|---|
| 32 | #include "../msg/lexutils.hh" |
|---|
| 33 | #include "../server.hh" |
|---|
| 34 | #include "../smtp_client/smtp_client.hh" |
|---|
| 35 | #include "../tlate/tlate.hh" |
|---|
| 36 | #include "../util.hh" |
|---|
| 37 | |
|---|
| 38 | #include <boost/shared_ptr.hpp> |
|---|
| 39 | |
|---|
| 40 | namespace http |
|---|
| 41 | { |
|---|
| 42 | class recovered : public templated_resource |
|---|
| 43 | { |
|---|
| 44 | public: |
|---|
| 45 | recovered(server::conn_cb cb) |
|---|
| 46 | : templated_resource(cb, "recovered.html") |
|---|
| 47 | {} |
|---|
| 48 | protected: |
|---|
| 49 | void set_attributes(boost::shared_ptr<request>, |
|---|
| 50 | tlate::data_model::ptr); |
|---|
| 51 | }; |
|---|
| 52 | |
|---|
| 53 | void recovered::set_attributes(boost::shared_ptr<request> req, |
|---|
| 54 | tlate::data_model::ptr am) |
|---|
| 55 | { |
|---|
| 56 | std::string (*const q)(std::string,bool) = html::quote; |
|---|
| 57 | std::string (*const dep)(std::string) = uri::percent_decode; |
|---|
| 58 | |
|---|
| 59 | std::string user = dep(req->get_form_field("userid")); |
|---|
| 60 | am->insert("userid", q(user,false)); |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | namespace |
|---|
| 65 | { |
|---|
| 66 | class factory : public server::http_resource_factory |
|---|
| 67 | { |
|---|
| 68 | public: |
|---|
| 69 | factory() { |
|---|
| 70 | server::register_http_resource("/recovered", this); |
|---|
| 71 | } |
|---|
| 72 | boost::shared_ptr<http::resource> operator() |
|---|
| 73 | (server::conn_cb cb, std::string) { |
|---|
| 74 | boost::shared_ptr<http::resource> rv |
|---|
| 75 | (new http::recovered(cb)); |
|---|
| 76 | return rv; |
|---|
| 77 | } |
|---|
| 78 | }; |
|---|
| 79 | factory f; |
|---|
| 80 | } |
|---|