apply login check optimization
This commit is contained in:
@@ -540,13 +540,9 @@ int main(int argc, char *argv[]) {
|
|||||||
CROW_ROUTE(app, "/freelancer/signup")
|
CROW_ROUTE(app, "/freelancer/signup")
|
||||||
([&, configuration](const crow::request& getRequest ) {
|
([&, configuration](const crow::request& getRequest ) {
|
||||||
auto& ctx = app.get_context<crow::CookieParser>(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;
|
string templateHTML = TEMPLATE_FREELANCER_SIGN_UP;
|
||||||
if (!freelancerEmail.empty() && !loginKey.empty()) {
|
if (Utilities::checkCookieLoginState(configuration, ctx))
|
||||||
if (Utilities::checkFreelancerLoginState(configuration, loginKey, freelancerEmail))
|
templateHTML = TEMPLATE_FREELANCER_REDIRECT_PROFILE;
|
||||||
templateHTML = TEMPLATE_FREELANCER_REDIRECT_PROFILE;
|
|
||||||
}
|
|
||||||
auto page = crow::mustache::load(templateHTML);
|
auto page = crow::mustache::load(templateHTML);
|
||||||
return page.render();
|
return page.render();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user