Changeset 751fac6
- Timestamp:
- 08/24/10 21:31:46 (3 years ago)
- Branches:
- master
- Children:
- 7eb42be
- Parents:
- ec0da3f
- git-author:
- Antti-Juhani Kaijanaho <antti-juhani@…> (08/24/10 21:31:46)
- git-committer:
- Antti-Juhani Kaijanaho <antti-juhani@…> (08/24/10 21:31:46)
- Location:
- http
- Files:
-
- 15 edited
-
article.cc (modified) (1 diff)
-
authn.cc (modified) (3 diffs)
-
compose.cc (modified) (9 diffs)
-
compose.hh (modified) (2 diffs)
-
error_resource.cc (modified) (2 diffs)
-
markread.cc (modified) (1 diff)
-
passwd.cc (modified) (4 diffs)
-
recovered.cc (modified) (2 diffs)
-
recovery.cc (modified) (2 diffs)
-
reguser.cc (modified) (7 diffs)
-
request.cc (modified) (5 diffs)
-
request.hh (modified) (5 diffs)
-
smanage.cc (modified) (7 diffs)
-
sub.cc (modified) (2 diffs)
-
threads.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
http/article.cc
rd3efc81 r751fac6 95 95 boost::shared_ptr<db::user> u = req->get_user(); 96 96 97 if (is_single && u && req->get_ query_param("markread") != "no")97 if (is_single && u && req->get_form_field("markread") != "no") 98 98 u->mark_read(art->msgid()); 99 99 -
http/authn.cc
rcc0a570 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 93 93 authn::tlate_value(boost::shared_ptr<request> req) 94 94 { 95 std::multimap<std::string,std::string> fb =96 req->get_form_data();97 95 std::string ruri = req->get_path(); 98 std::string query = req->get_ query_or_body();96 std::string query = req->get_form_as_query(); 99 97 if (!query.empty()) ruri += "?" + query; 100 98 tlate::value::ptr rv(new authn_value(req->get_user(), 101 lookup102 ( fb,"user.authn.message"),99 req->get_form_field 100 ("user.authn.message"), 103 101 ruri)); 104 102 return rv; … … 108 106 (boost::shared_ptr<request> req, response::factory rf) 109 107 { 110 std::multimap<std::string,std::string> fb = 111 req->get_form_data(); 112 ::uri redir = lookup(fb, "redirect"); 108 ::uri redir = req->get_form_field("redirect"); 113 109 114 110 std::string msg_name = "user.authn.message"; 115 111 116 if (req->get_path() == "/login" && fb.find("login") != fb.end())112 if (req->get_path() == "/login" && req->has_form_field("login")) 117 113 { 118 std::string user = lookup(fb,"userid");119 std::string pass = lookup(fb,"passwd");114 std::string user = req->get_form_field("userid"); 115 std::string pass = req->get_form_field("passwd"); 120 116 boost::shared_ptr<session> sess(new session()); 121 117 sess->authenticate(cb.dbase().lookup_user(user), pass); -
http/compose.cc
r4c34ee2 r751fac6 96 96 void compose::reload_action(boost::shared_ptr<request> req, 97 97 tlate::data_model::ptr am, 98 std::multimap<std::string,std::string> &fb,99 98 std::string error_message) 100 99 { 101 typedef std::multimap<std::string,std::string>::const_iterator 102 cit_type; 100 typedef request::form_data_iterator cit_type; 103 101 std::pair<cit_type, cit_type> its; 104 102 105 103 if (!error_message.empty()) 106 104 am->insert("error", html::quote(error_message, false)); 107 am->insert("subject", lookup(fb,"subject"));108 am->insert("references", lookup(fb,"references"));109 am->insert("body", lookup(fb,"body"));105 am->insert("subject", req->get_form_field("subject")); 106 am->insert("references", req->get_form_field("references")); 107 am->insert("body", req->get_form_field("body")); 110 108 111 109 std::list<std::string> ngs; 112 its = fb.equal_range("newsgroups");110 its = req->get_form_fields("newsgroups"); 113 111 for (cit_type it = its.first; it != its.second; it++) 114 112 ngs.push_back(it->second); 115 113 116 114 std::list<std::string> fus; 117 its = fb.equal_range("followups");115 its = req->get_form_fields("followups"); 118 116 for (cit_type it = its.first; it != its.second; it++) 119 117 fus.push_back(it->second); … … 123 121 124 122 void compose::post_action(boost::shared_ptr<request> req, 125 tlate::data_model::ptr am, 126 std::multimap<std::string,std::string> &fb) 123 tlate::data_model::ptr am) 127 124 { 128 125 std::ostringstream os; … … 141 138 os << "Newsgroups: "; 142 139 bool first = true; 143 its = fb.equal_range("newsgroups");140 its = req->get_form_fields("newsgroups"); 144 141 for (cit_type it = its.first; it != its.second; it++) 145 142 { … … 150 147 os << "\r\n"; 151 148 152 its = fb.equal_range("followups");149 its = req->get_form_fields("followups"); 153 150 if (its.first != its.second) 154 151 { … … 165 162 166 163 os << "Subject: " 167 << msg::encode_unstructured( lookup(fb,"subject"))164 << msg::encode_unstructured(req->get_form_field("subject")) 168 165 << "\r\n"; 169 166 170 std::string refs = lookup(fb,"references");167 std::string refs = req->get_form_field("references"); 171 168 if (!refs.empty()) 172 169 { … … 180 177 " format=flowed; delsp=yes"; 181 178 182 msg::text_plain tp(msg::crlf_canonize( lookup(fb,"body")),179 msg::text_plain tp(msg::crlf_canonize(req->get_form_field("body")), 183 180 msg::content_type(content_type)); 184 181 … … 235 232 catch (std::exception &e) 236 233 { 237 return reload_action(req, am, fb,e.what());234 return reload_action(req, am, e.what()); 238 235 } 239 236 logger::logline ll; … … 266 263 } 267 264 268 std::multimap<std::string,std::string> fb = 269 req->get_form_data(); 270 std::map<std::string,std::string>::const_iterator fbit; 271 272 fbit = fb.find("post_button"); 273 if (fbit != fb.end()) 265 if (req->has_form_field("post_button")) 274 266 { 275 267 if (req->get_method() == "POST") 276 return post_action(req, am , fb);268 return post_action(req, am); 277 269 else 278 return reload_action(req, am, fb); 279 } 280 281 fbit = fb.find("group"); 282 if (fbit != fb.end()) 270 return reload_action(req, am); 271 } 272 273 if (req->has_form_field("group")) 283 274 { 284 275 boost::shared_ptr<db::group> group; 285 276 try 286 277 { 287 group = cb.dbase().lookup_group(fbit->second); 278 group = cb.dbase().lookup_group 279 (req->get_form_field("group")); 288 280 } 289 281 catch (db::no_such_group) … … 291 283 resp.reset(new error_resource 292 284 (cb, "404 No such group " + 293 fbit->second));285 req->get_form_field("group"))); 294 286 throw resource_exception(resp); 295 287 } 296 288 return new_thread(req, am, group); 297 289 } 298 fbit = fb.find("precursor"); 299 if ( fbit != fb.end())290 291 if (req->has_form_field("precursor")) 300 292 { 301 293 boost::shared_ptr<msg::msg> art; 294 std::string pre = req->get_form_field("precursor"); 302 295 try 303 296 { 304 art = cb.dbase().lookup_msgid( fbit->second);297 art = cb.dbase().lookup_msgid(pre); 305 298 } 306 299 catch (db::no_such_article) 307 300 { 308 301 resp.reset(new error_resource 309 (cb, "404 No such article " + 310 fbit->second)); 302 (cb, "404 No such article " + pre)); 311 303 throw resource_exception(resp); 312 304 } -
http/compose.hh
r868b365 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 35 35 void reload_action(boost::shared_ptr<request> req, 36 36 tlate::data_model::ptr, 37 std::multimap<std::string,std::string> &fb,38 37 std::string error_message = ""); 39 38 40 39 void post_action(boost::shared_ptr<request> req, 41 tlate::data_model::ptr, 42 std::multimap<std::string,std::string> &fb); 40 tlate::data_model::ptr); 43 41 44 42 void respond_compose(boost::shared_ptr<request>, -
http/error_resource.cc
r868b365 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 33 33 am->insert("host", req->get_host()); 34 34 std::string rpath = req->get_path(); 35 std::string query = req->get_ query_or_body();35 std::string query = req->get_form_as_query(); 36 36 if (!query.empty()) rpath += "?" + query; 37 37 am->insert("path", rpath); -
http/markread.cc
rec0da3f r751fac6 50 50 } 51 51 52 std::multimap<std::string,std::string> fd = req->get_form_data(); 53 std::string ajax = lookup(fd, "ajax"); 54 bool value = lookup(fd, "undo") != "yes"; 55 std::string msgid = lookup(fd, "msgid"); 56 ::uri redir = lookup(fd, "redir"); 52 std::string ajax = req->get_form_field("ajax"); 53 bool value = req->get_form_field("undo") != "yes"; 54 std::string msgid = req->get_form_field("msgid"); 55 ::uri redir = req->get_form_field("redir"); 57 56 redir.replace_query_param("markread","no"); 58 57 -
http/passwd.cc
rcc0a570 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 54 54 std::string (*const dep)(std::string) = uri::percent_decode; 55 55 56 std::multimap<std::string,std::string> fb = 57 req->get_form_data(); 58 std::string uid = dep(lookup(fb, "userid")); 59 std::string pw1 = dep(lookup(fb, "password")); 60 std::string pw2 = dep(lookup(fb, "repass")); 61 std::string tokstr = dep(lookup(fb, "token")); 56 std::string uid = dep(req->get_form_field("userid")); 57 std::string pw1 = dep(req->get_form_field("password")); 58 std::string pw2 = dep(req->get_form_field("repass")); 59 std::string tokstr = dep(req->get_form_field("token")); 62 60 63 61 boost::shared_ptr<token> &tok = cb.get_http_token(tokstr); … … 176 174 } 177 175 178 std::multimap<std::string,std::string> fb =179 req->get_form_data();180 181 176 std::string tokstr; 182 177 boost::shared_ptr<token> tok; … … 224 219 am->insert("accept_charlist", q("utf8",false)); 225 220 226 std::string errmsg = dep( lookup(fb,"msg"));221 std::string errmsg = dep(req->get_form_field("msg")); 227 222 if (!errmsg.empty()) 228 223 am->insert("errmsg", q(errmsg, false)); -
http/recovered.cc
rcc0a570 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 57 57 std::string (*const dep)(std::string) = uri::percent_decode; 58 58 59 std::multimap<std::string,std::string> fb = 60 req->get_form_data(); 61 std::string user = dep(lookup(fb, "userid")); 59 std::string user = dep(req->get_form_field("userid")); 62 60 am->insert("userid", q(user,false)); 63 61 } -
http/recovery.cc
rcc0a570 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 80 80 // std::string (*const dep)(std::string) = uri::percent_decode; 81 81 82 std::multimap<std::string,std::string> fb = 83 req->get_form_data(); 84 85 std::string user = lookup(fb, "userid"); 82 std::string user = req->get_form_field("userid"); 86 83 boost::shared_ptr<db::user> u = cb.dbase().lookup_user(user); 87 84 if (u) -
http/reguser.cc
rcc0a570 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 56 56 void reload_action(boost::shared_ptr<request> req, 57 57 tlate::data_model::ptr, 58 std::multimap<std::string,std::string> &fb,59 58 std::string error_message = ""); 60 59 61 60 void post_action(boost::shared_ptr<request> req, 62 tlate::data_model::ptr, 63 std::multimap<std::string,std::string> &fb); 61 tlate::data_model::ptr); 64 62 }; 65 63 66 void reguser::reload_action(boost::shared_ptr<request> ,64 void reguser::reload_action(boost::shared_ptr<request> req, 67 65 tlate::data_model::ptr am, 68 std::multimap<std::string,std::string> &fb,69 66 std::string error_message) 70 67 { 71 68 if (!error_message.empty()) 72 69 am->insert("error", html::quote(error_message, false)); 73 am->insert("userid", lookup(fb,"userid"));70 am->insert("userid", req->get_form_field("userid")); 74 71 } 75 72 76 73 void reguser::post_action(boost::shared_ptr<request> req, 77 tlate::data_model::ptr am, 78 std::multimap<std::string,std::string> &fb) 74 tlate::data_model::ptr am) 79 75 { 80 76 boost::random_device rand; 81 77 std::string (*const pd)(std::string) = uri::percent_decode; 82 78 83 std::string pw1 = lookup(fb,"passwd");84 std::string pw2 = lookup(fb,"repass");79 std::string pw1 = req->get_form_field("passwd"); 80 std::string pw2 = req->get_form_field("repass"); 85 81 86 82 std::string err = db::user::passwd_problems(pw1); … … 89 85 if (!err.empty()) 90 86 { 91 reload_action(req, am, fb,err);87 reload_action(req, am, err); 92 88 return; 93 89 } 94 90 95 std::string uid = pd( lookup(fb,"userid"));91 std::string uid = pd(req->get_form_field("userid")); 96 92 if (uid.find_first_of("\t ") != std::string::npos) 97 93 { 98 reload_action(req, am, fb,94 reload_action(req, am, 99 95 "User id should not contain whitespace."); 100 96 return; … … 104 100 try 105 101 { 106 u = cb.dbase().create_user(pd( lookup(fb,"userid")),102 u = cb.dbase().create_user(pd(req->get_form_field("userid")), 107 103 pw1); 108 104 } 109 105 catch (db::user_exists) 110 106 { 111 reload_action(req, am, fb,107 reload_action(req, am, 112 108 "That user id is not available."); 113 109 return; … … 115 111 116 112 boost::shared_ptr<session> sess(new session()); 117 sess->authenticate(u, lookup(fb,"passwd"));113 sess->authenticate(u, req->get_form_field("passwd")); 118 114 119 115 boost::shared_ptr<resource> rr … … 131 127 throw resource_exception(resp); 132 128 } 133 std::multimap<std::string,std::string> fb =134 req->get_form_data();135 136 129 if (req->is_authenticated()) 137 130 { 138 reload_action(req, am, fb,131 reload_action(req, am, 139 132 "You must log out before" 140 133 " you can continue registration"); … … 142 135 } 143 136 144 std::map<std::string,std::string>::const_iterator fbit; 145 146 fbit = fb.find("regbut"); 147 if (fbit != fb.end()) 137 if (req->has_form_field("regbut")) 148 138 { 149 139 if (req->get_method() == "POST") 150 post_action(req, am , fb);140 post_action(req, am); 151 141 else 152 reload_action(req, am , fb);142 reload_action(req, am); 153 143 } 154 144 -
http/request.cc
r868b365 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 53 53 boost::asio::ip::address peer) 54 54 : cb(cb), peer(peer), v11(true), close(false) 55 , form_data_ready(false) 55 56 { 56 57 typedef bad_request fv; … … 108 109 if (v11 && token == "close") close = true; 109 110 } 111 112 } 113 114 void request::parse_form() const 115 { 116 if (form_data_ready) return; 117 if (method != "POST" || 118 get_header("content-type") 119 == "application/x-www-form-urlencoded") 120 { 121 std::string bd = method == "POST" 122 ? body 123 : uri.get_query(); 124 while (!bd.empty()) 125 { 126 std::string entry = util::split1R(bd, "&"); 127 for (size_t i = 0; i < entry.length(); i++) 128 if (entry[i] == '+') entry[i] = ' '; 129 std::string name = util::split1R(entry, "="); 130 name = uri::percent_decode(name); 131 entry = uri::percent_decode(entry); 132 form_data.insert(std::make_pair(name, entry)); 133 } 134 } 135 form_data_ready = true; 136 } 137 138 std::string request::get_form_as_query() const 139 { 140 if (!form_data_ready) parse_form(); 141 std::string rv; 142 for (std::multimap<std::string, std::string>::const_iterator it 143 = form_data.begin(); 144 it != form_data.end(); it++) 145 { 146 std::string name = uri::percent_encode(it->first); 147 std::string value = uri::percent_encode(it->second); 148 if (!rv.empty()) rv += '&'; 149 rv += name; 150 rv += "="; 151 rv += value; 152 } 153 return rv; 110 154 } 111 155 … … 117 161 if (it == header.end()) return ""; 118 162 return it->second; 119 }120 121 std::string request::get_query_or_body() const122 {123 if (method == "POST")124 {125 std::string ct = get_header("content-type");126 util::strip(ct);127 if (ct != "application/x-www-form-urlencoded")128 std::cerr << "FIXME get_query_or_body: " << ct129 << std::endl;130 return body;131 }132 else133 {134 return uri.get_query();135 }136 }137 138 std::multimap<std::string,std::string> request::get_form_data() const139 {140 std::multimap<std::string, std::string> rv;141 142 std::string bd = get_query_or_body();143 while (!bd.empty())144 {145 std::string entry = util::split1R(bd, "&");146 for (size_t i = 0; i < entry.length(); i++)147 if (entry[i] == '+') entry[i] = ' ';148 std::string name = util::split1R(entry, "=");149 name = uri::percent_decode(name);150 entry = uri::percent_decode(entry);151 rv.insert(std::make_pair(name, entry));152 }153 return rv;154 163 } 155 164 … … 241 250 } 242 251 if (sessid.empty() || !cb.get_session(sessid)) return ""; 243 std::multimap<std::string,std::string> fd = get_form_data(); 244 std::string fd_session = lookup(fd, "alue_sessid"); 252 std::string fd_session = get_form_field("alue_sessid"); 245 253 if (method != "POST" && !fd_session.empty()) 246 254 { -
http/request.hh
ra7da244 r751fac6 34 34 { 35 35 public: 36 typedef std::multimap<std::string,std::string>::const_iterator 37 form_data_iterator; 38 36 39 request(std::string, server::conn_cb cb, 37 40 boost::asio::ip::address); … … 39 42 bool get_close() const { return close; } 40 43 41 void body_append(std::string b) { body += b; } 44 void body_append(std::string b) { 45 form_data_ready = false; 46 body += b; 47 } 42 48 std::string get_body() const { return body; } 43 44 std::multimap<std::string,std::string> get_form_data() const;45 49 46 50 bool has_body() const { … … 56 60 int get_port() const { return port; } 57 61 std::string get_path() const { return uri.get_path(); } 58 std::string get_query() const { return uri.get_query(); }59 62 60 std::string get_query_param(std::string name) const { 61 return uri.get_query_param(name); 63 std::string get_form_field(std::string name) const; 64 bool has_form_field(std::string name) const; 65 std::pair<form_data_iterator,form_data_iterator> 66 get_form_fields(std::string name) const { 67 if (!form_data_ready) parse_form(); 68 return form_data.equal_range(name); 62 69 } 70 71 std::string get_form_as_query() const; 63 72 64 73 std::string get_header(std::string s) const; 65 66 std::string get_query_or_body() const;67 74 68 75 std::string logbit() const { … … 91 98 int port; 92 99 std::string body; 100 mutable bool form_data_ready; 101 mutable std::multimap<std::string,std::string> form_data; 93 102 94 103 void parse_header(std::string); 104 void parse_form() const; 95 105 }; 96 106 97 107 inline 98 std::string lookup(const std::multimap<std::string, std::string> &mm, 99 std::string k) 108 std::string request::get_form_field(std::string k) const 100 109 { 110 if (!form_data_ready) parse_form(); 101 111 std::multimap<std::string, std::string>::const_iterator it 102 = mm.find(k);103 if (it == mm.end())112 = form_data.find(k); 113 if (it == form_data.end()) 104 114 { 105 115 return ""; … … 107 117 return it->second; 108 118 } 119 inline 120 bool request::has_form_field(std::string k) const 121 { 122 if (!form_data_ready) parse_form(); 123 std::multimap<std::string, std::string>::const_iterator it 124 = form_data.find(k); 125 return it != form_data.end(); 126 } 109 127 } 110 128 -
http/smanage.cc
rd0c602a r751fac6 51 51 void reload_action(boost::shared_ptr<request>, 52 52 tlate::data_model::ptr, 53 std::multimap<std::string,std::string> &fb,54 53 std::string error_message = ""); 55 54 56 55 void post_action(boost::shared_ptr<request> req, 57 tlate::data_model::ptr, 58 std::multimap<std::string,std::string> &fb); 56 tlate::data_model::ptr); 59 57 }; 60 58 61 59 void smanage::reload_action(boost::shared_ptr<request> req, 62 60 tlate::data_model::ptr am, 63 std::multimap<std::string,std::string> &fb,64 61 std::string error_message) 65 62 { 66 typedef std::multimap<std::string,std::string>::const_iterator67 cit_type;68 std::pair<cit_type, cit_type> its;69 70 63 if (!error_message.empty()) 71 64 am->insert("error", html::quote(error_message, false)); 72 am->insert("diname", lookup(fb,"diname"));73 am->insert("diaddr", lookup(fb,"diaddr"));74 std::string deaddr = lookup(fb,"deaddr");65 am->insert("diname", req->get_form_field("diname")); 66 am->insert("diaddr", req->get_form_field("diaddr")); 67 std::string deaddr = req->get_form_field("deaddr"); 75 68 am->insert("deaddr", deaddr); 76 69 db::user::ptr u = req->get_session()->get_user(); … … 81 74 am->insert("verify"); 82 75 83 if (fb.find("allow_clear") != fb.end()) 84 am->insert("allow_clear", lookup(fb, "allow_clear")); 76 if (req->has_form_field("allow_clear")) 77 am->insert("allow_clear", 78 req->get_form_field("allow_clear")); 85 79 } 86 80 87 81 void smanage::post_action(boost::shared_ptr<request> req, 88 tlate::data_model::ptr am, 89 std::multimap<std::string,std::string> &fb) 82 tlate::data_model::ptr am) 90 83 { 91 84 std::string (*const pd)(std::string) = uri::percent_decode; … … 93 86 boost::shared_ptr<db::user> u = req->get_session()->get_user(); 94 87 95 u->set_display_name(pd( lookup(fb,"diname")));96 u->set_display_email(pd( lookup(fb,"diaddr")));97 if (u->set_delivery_email(pd( lookup(fb,"deaddr")))) {88 u->set_display_name(pd(req->get_form_field("diname"))); 89 u->set_display_email(pd(req->get_form_field("diaddr"))); 90 if (u->set_delivery_email(pd(req->get_form_field("deaddr")))) { 98 91 u->send_delivery_email_cookie 99 92 (cb, req->get_peer().to_string()); 100 93 } 101 94 u->set_allow_cleartext_password 102 ( fb.find("allow_clear") != fb.end());103 reload_action(req, am, fb,"Saved.");95 (req->has_form_field("allow_clear")); 96 reload_action(req, am, "Saved."); 104 97 } 105 98 … … 121 114 } 122 115 123 std::multimap<std::string,std::string> fb = 124 req->get_form_data(); 125 std::map<std::string,std::string>::const_iterator fbit_ch; 126 std::map<std::string,std::string>::const_iterator fbit_ve; 127 128 fbit_ch = fb.find("change_button"); 129 fbit_ve = fb.find("verify_button"); 130 if (fbit_ch != fb.end()) 116 if (req->has_form_field("change_button")) 131 117 { 132 118 if (req->get_method() == "POST") 133 post_action(req, am , fb);119 post_action(req, am); 134 120 else 135 reload_action(req, am , fb);121 reload_action(req, am); 136 122 137 123 } 138 else if ( fbit_ve != fb.end())124 else if (req->has_form_field("verify_button")) 139 125 { 140 126 boost::shared_ptr<db::user> u = … … 144 130 u->send_delivery_email_cookie 145 131 (cb, req->get_peer().to_string()); 146 reload_action(req, am, fb,132 reload_action(req, am, 147 133 "Verification email has been " 148 134 "sent to " + … … 150 136 } 151 137 else 152 reload_action(req, am , fb);138 reload_action(req, am); 153 139 } 154 140 else … … 166 152 if (u->allow_cleartext_password()) 167 153 am->insert("allow_clear", 168 lookup(fb,"allow_clear"));154 req->get_form_field("allow_clear")); 169 155 } 170 156 -
http/sub.cc
r4c34ee2 r751fac6 50 50 (boost::shared_ptr<request> req, response::factory) 51 51 { 52 std::multimap<std::string,std::string> fb = 53 req->get_form_data(); 54 std::string redir = lookup(fb, "redir"); 52 std::string redir = req->get_form_field("redir"); 55 53 if (redir.empty()) 56 54 { … … 81 79 try 82 80 { 83 gr = cb.dbase().lookup_group( lookup(fb,"group"));81 gr = cb.dbase().lookup_group(req->get_form_field("group")); 84 82 } 85 83 catch (db::no_such_group) 86 84 { 87 85 logger::logline ll; 88 ll << "no such group " << lookup(fb,"group");86 ll << "no such group " << req->get_form_field("group"); 89 87 throw resource_exception(resp); 90 88 } -
http/threads.cc
r299b297 r751fac6 1 1 /* This file is part of Alue, the multiprotocol Internet discussion daemon 2 2 3 Copyright © 2009 Antti-Juhani Kaijanaho3 Copyright © 2009, 2010 Antti-Juhani Kaijanaho 4 4 5 5 Alue is free software: you can redistribute it and/or modify it … … 78 78 } 79 79 80 std::multimap<std::string,std::string> fb = 81 req->get_form_data(); 82 bool only_summary = lookup(fb, "summary") == "true"; 80 bool only_summary = req->get_form_field("summary") == "true"; 83 81 84 82 am->insert("group", new tlate::group_value(gr, u));
Note: See TracChangeset
for help on using the changeset viewer.
