implement freelancer alias base management page

and minor fixes
This commit is contained in:
Tina_Azure
2023-05-19 18:06:14 +02:00
parent 1620967c45
commit d83b427857
7 changed files with 93 additions and 6 deletions

View File

@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
*/
CROW_ROUTE(app, "/@<string>")
([configuration](string alias) {
crow::mustache::context ctx(getAlias(configuration, alias));
crow::mustache::context ctx(Utilities::getAlias(configuration, alias));
auto page = crow::mustache::load(TEMPLATE_ALIAS_REDIRECT);
return page.render(ctx);
});
@ -771,7 +771,6 @@ int main(int argc, char *argv[]) {
/*
* Execute Template Operation
* todo:implement
*/
CROW_ROUTE(app, "/freelancer/templateManagement/fulfilment/<string>").methods("POST"_method)
([&, configuration](const crow::request& postRequest, string operation ) {
@ -855,6 +854,22 @@ int main(int argc, char *argv[]) {
return page.render(ctx);
});
/*
* Page for freelancer to create/delete Alias
*/
CROW_ROUTE(app, "/freelancer/aliasManagement")
([&, configuration](const crow::request& getRequest ) {
auto& cookieCtx = app.get_context<crow::CookieParser>(getRequest);
crow::mustache::context ctx;
if (Utilities::checkCookieLoginState(configuration, cookieCtx)) {
ctx = Utilities::getFreelancerAlias(configuration, cookieCtx.get_cookie(COOKIE_FREELANCER_EMAIL));
ctx["freelanceremail"] = cookieCtx.get_cookie(COOKIE_FREELANCER_EMAIL);
ctx[MUSTACHE_COOKIE_LOGGED_IN] = true;
}
auto page = crow::mustache::load(TEMPLATE_FREELANCER_ALIAS_MANAGEMENT);
return page.render(ctx);
});