#include "PassphrasePage.h" #include "Poco/Net/HTTPServerRequest.h" #include "Poco/Net/HTTPServerResponse.h" #include "Poco/Net/HTMLForm.h" #include "Poco/DeflatingStream.h" #line 7 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" #include "../SingletonManager/SessionManager.h" //#include "Poco/Net/HTTPServerParams.h" enum PageState { PAGE_ASK_PASSPHRASE, PAGE_SHOW_PASSPHRASE }; #line 1 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\header.cpsp" #include "../ServerConfig.h" PassphrasePage::PassphrasePage(Session* arg): SessionHTTPRequestHandler(arg) { } void PassphrasePage::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response) { response.setChunkedTransferEncoding(true); response.setContentType("text/html"); bool _compressResponse(request.hasToken("Accept-Encoding", "gzip")); if (_compressResponse) response.set("Content-Encoding", "gzip"); Poco::Net::HTMLForm form(request, request.stream()); #line 17 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" const char* pageName = "Passphrase"; PageState state = PAGE_ASK_PASSPHRASE; auto sm = SessionManager::getInstance(); auto uri_start = ServerConfig::g_serverPath;//request.serverParams().getServerName(); // remove old cookies if exist sm->deleteLoginCookies(request, response, mSession); // save login cookie, because maybe we've get an new session response.addCookie(mSession->getLoginCookie()); if (!form.empty()) { auto registerKeyChoice = form.get("passphrase", ""); std::string oldPassphrase = ""; if (registerKeyChoice == "no") { auto oldPassphrase = form.get("passphrase-existing", ""); if (oldPassphrase != "" && User::validatePassphrase(oldPassphrase)) { // passphrase is valid mSession->setPassphrase(oldPassphrase); mSession->updateState(SESSION_STATE_PASSPHRASE_SHOWN); state = PAGE_SHOW_PASSPHRASE; } else { addError(new Error("Passphrase", "Diese Passphrase ist ungültig, bitte überprüfen oder neu generieren (lassen).")); } } else if (registerKeyChoice == "yes") { mSession->generatePassphrase(); } } if(mSession->getSessionState() == SESSION_STATE_PASSPHRASE_GENERATED) { state = PAGE_SHOW_PASSPHRASE; mSession->updateState(SESSION_STATE_PASSPHRASE_SHOWN); } getErrors(mSession); std::ostream& _responseStream = response.send(); Poco::DeflatingOutputStream _gzipStream(_responseStream, Poco::DeflatingStreamBuf::STREAM_GZIP, 1); std::ostream& responseStream = _compressResponse ? _gzipStream : _responseStream; responseStream << "\n"; // begin include header.cpsp responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "Gradido Login Server: "; #line 9 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\header.cpsp" responseStream << ( pageName ); responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "\n"; responseStream << "
\n"; responseStream << "\t

Login Server in Entwicklung

\n"; responseStream << "\t

Alpha 0.4.4

\n"; responseStream << "
\n"; responseStream << ""; // end include header.cpsp responseStream << "\n"; responseStream << "
\n"; responseStream << "\t

Einen neuen Account anlegen

\n"; responseStream << "\t"; #line 57 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" responseStream << ( getErrorsHtml() ); responseStream << "\n"; responseStream << "\t"; #line 58 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" if(state == PAGE_SHOW_PASSPHRASE) { responseStream << "\n"; responseStream << "\t\t
\n"; responseStream << "\t\t\t
\n"; responseStream << "\t\t\t\tSchreibe dir die Passphrase auf und packe sie gut weg. Du brauchst sie um deine Adresse wiederherzustellen. Wenn du ihn verlierst, sind auch deine Gradidos verloren.\n"; responseStream << "\t\t\t
\n"; responseStream << "\t\t\t
\n"; responseStream << "\t\t\t\t"; #line 64 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" responseStream << ( mSession->getPassphrase() ); responseStream << "\n"; responseStream << "\t\t\t
\n"; responseStream << "\t\t\t
\n"; responseStream << "\t\t\tWeiter\n"; responseStream << "\t\t
\n"; responseStream << "\t"; #line 69 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" } else if(state == PAGE_ASK_PASSPHRASE) { responseStream << "\n"; responseStream << "\t

Deine E-Mail Adresse wurde erfolgreich bestätigt.

\n"; responseStream << "\t
\n"; responseStream << "\t\t
\n"; responseStream << "\t\t\tNeue Gradido Adresse anlegen / wiederherstellen\n"; responseStream << "\t\t\t

Hast du schonmal ein Gradido Konto besessen?

\n"; responseStream << "\t\t\t

\n"; responseStream << "\t\t\t\t\n"; responseStream << "\t\t\t\t\n"; responseStream << "\t\t\t

\n"; responseStream << "\t\t\t

\n"; responseStream << "\t\t\t\t\n"; responseStream << "\t\t\t\t\n"; responseStream << "\t\t\t

\n"; responseStream << "\t\t\t\n"; responseStream << "\t\t
\n"; responseStream << "\t\t\n"; responseStream << "\t\t\n"; responseStream << "\t\t\n"; responseStream << "\t
\n"; responseStream << "\t"; #line 89 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" } else { responseStream << "\n"; responseStream << "\t\t
\n"; responseStream << "\t\t\tUngültige Seite, wenn du das siehst stimmt hier etwas nicht. Bitte wende dich an den Server-Admin. \n"; responseStream << "\t\t
\n"; responseStream << "\t"; #line 93 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\passphrase.cpsp" } responseStream << "\n"; responseStream << "
\n"; // begin include footer.cpsp responseStream << "\t
\n"; responseStream << "\t\t\t"; #line 2 "I:\\Code\\C++\\Eigene_Projekte\\Gradido_LoginServer\\src\\cpsp\\footer.cpsp" responseStream << ( mTimeProfiler.string() ); responseStream << "\n"; responseStream << "\t
\n"; responseStream << "\n"; responseStream << ""; // end include footer.cpsp responseStream << "\n"; if (_compressResponse) _gzipStream.close(); }