Secure Cookie Values from hardcoding to const static variable
This commit is contained in:
@ -288,8 +288,8 @@ int main(int argc, char *argv[]) {
|
||||
pqxx::connection databaseConnection(configuration.databaseConnectionString);
|
||||
Database::prepareStatement(databaseConnection, ID_UPDATE_LOGIN_VALIDATION_KEY);
|
||||
Database::executePreparedStatement_UPDATE_LOGIN_VALIDATION_KEY(databaseConnection, "EXPIRED", freelancerEmail);
|
||||
ctx.set_cookie("loginKey", Utilities::generateExpiredCookie());
|
||||
ctx.set_cookie("freelancerEmail", Utilities::generateExpiredCookie());
|
||||
ctx.set_cookie(COOKIE_LOGIN_KEY, Utilities::generateExpiredCookie());
|
||||
ctx.set_cookie(COOKIE_FREELANCER_EMAIL, Utilities::generateExpiredCookie());
|
||||
}
|
||||
res.redirect("/");
|
||||
res.end();
|
||||
@ -502,8 +502,8 @@ int main(int argc, char *argv[]) {
|
||||
Database::executePreparedStatement_UPDATE_LOGIN_VALIDATION_KEY(databaseConnection, loginKeyValue, email);
|
||||
std::string loginKeyCookieValue = Utilities::generateSecureCookieLoginKeyValue(loginKeyValue, stayLoggedIn);
|
||||
std::string freelancerEmailCookieValue = Utilities::generateSecureCookieFreelancerEmailValue(email, stayLoggedIn);
|
||||
cookieCtx.set_cookie("loginKey", loginKeyCookieValue);
|
||||
cookieCtx.set_cookie("freelancerEmail",freelancerEmailCookieValue);
|
||||
cookieCtx.set_cookie(COOKIE_LOGIN_KEY, loginKeyCookieValue);
|
||||
cookieCtx.set_cookie(COOKIE_FREELANCER_EMAIL,freelancerEmailCookieValue);
|
||||
ctx[MUSTACHE_LOGIN_SUCCESS] = true;
|
||||
ctx[MUSTACHE_COOKIE_LOGGED_IN] = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user