@@ -25,6 +25,7 @@ along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
2525#include " network/endpoint.hpp"
2626#include " network/bundle.hpp"
2727#include " helper/debug_helper.hpp"
28+ #include " server/serverconfig.hpp"
2829
2930#include " ../../server/dbmgr/dbmgr_interface.hpp"
3031
@@ -197,13 +198,41 @@ int AccountActivateHandler::handleInputNotification(int fd)
197198 return 0 ;
198199 }
199200
201+ std::string hellomessage;
202+
200203 if (type == 1 )
201204 {
202205 // Ïòdbmgr¼¤»îÕ˺Å
203206 Mercury::Bundle bundle;
204207 bundle.newMessage (DbmgrInterface::accountActivate);
205208 bundle << code;
206209 bundle.send (Loginapp::getSingleton ().getNetworkInterface (), dbmgrinfos->pChannel );
210+
211+ hellomessage = g_kbeSrvConfig.emailAtivationInfo_ .backlink_hello_message ;
212+ }
213+ else if (type == 2 )
214+ {
215+ hellomessage = g_kbeSrvConfig.emailResetPasswordInfo_ .backlink_hello_message ;
216+ }
217+ else if (type == 3 )
218+ {
219+ hellomessage = g_kbeSrvConfig.emailBindInfo_ .backlink_hello_message ;
220+ }
221+
222+ if (hellomessage.size () > 0 )
223+ {
224+ KBEngine::strutil::kbe_replace (hellomessage, " ${backlink}" , (boost::format (" http://%1%:%2%/%3%?%4%" ) %
225+ Loginapp::getSingleton ().getNetworkInterface ().extaddr ().ipAsString () %
226+ g_kbeSrvConfig.emailServerInfo_ .cb_port %
227+ keys %
228+ code).str ());
229+
230+ KBEngine::strutil::kbe_replace (hellomessage, " ${code}" , code);
231+
232+ std::string response = (boost::format (" HTTP/1.1 200 OK\r\n Content-Type: text/html\r\n Content-Length: %1%\r\n\r\n %2%" ) %
233+ hellomessage.size () % hellomessage).str ();
234+
235+ newclient->send (response.c_str (), response.size ());
207236 }
208237 }
209238 else
@@ -227,11 +256,17 @@ void AccountActivateHandler::onAccountActivated(std::string& code, bool success)
227256 if (!iter->second .endpoint ->good ())
228257 continue ;
229258
259+ std::string message;
260+
230261 if (success)
231- iter-> second . endpoint -> send (g_kbeSrvConfig. emailAtivationInfo_ . backlink_success_message . c_str (), g_kbeSrvConfig.emailAtivationInfo_ .backlink_success_message . size ()) ;
262+ message = g_kbeSrvConfig.emailAtivationInfo_ .backlink_success_message ;
232263 else
233- iter->second .endpoint ->send (g_kbeSrvConfig.emailAtivationInfo_ .backlink_fail_message .c_str (), g_kbeSrvConfig.emailAtivationInfo_ .backlink_fail_message .size ());
234- iter->second .endpoint ->close ();
264+ message = g_kbeSrvConfig.emailAtivationInfo_ .backlink_fail_message ;
265+
266+ std::string response = (boost::format (" HTTP/1.1 200 OK\r\n Content-Type: text/html\r\n Content-Length: %1%\r\n\r\n %2%" ) %
267+ message.size () % message).str ();
268+
269+ iter->second .endpoint ->send (response.c_str (), response.size ());
235270 }
236271 }
237272}
0 commit comments