apply login check optimization

This commit is contained in:
Tina_Azure
2023-05-10 22:32:04 +02:00
parent 123d98828c
commit 8fa55a8bfd

View File

@ -540,13 +540,9 @@ int main(int argc, char *argv[]) {
CROW_ROUTE(app, "/freelancer/signup")
([&, configuration](const crow::request& getRequest ) {
auto& ctx = app.get_context<crow::CookieParser>(getRequest);
string loginKey = ctx.get_cookie("loginKey");
string freelancerEmail = ctx.get_cookie("freelancerEmail");
string templateHTML = TEMPLATE_FREELANCER_SIGN_UP;
if (!freelancerEmail.empty() && !loginKey.empty()) {
if (Utilities::checkFreelancerLoginState(configuration, loginKey, freelancerEmail))
templateHTML = TEMPLATE_FREELANCER_REDIRECT_PROFILE;
}
if (Utilities::checkCookieLoginState(configuration, ctx))
templateHTML = TEMPLATE_FREELANCER_REDIRECT_PROFILE;
auto page = crow::mustache::load(templateHTML);
return page.render();
});