password reset route handler

This commit is contained in:
Tina_Azure
2023-04-27 00:30:20 +02:00
parent 7f277994a9
commit 6dcc89b479

View File

@ -317,6 +317,26 @@ int main(int argc, char *argv[]) {
auto page = crow::mustache::load("freelancer_Login_PasswordReset.html");
return page.render(ctx);
});
/*
* Page for freelancer to reset a password from a requested PasswordReset
*/
CROW_ROUTE(app, "/passwordreset/<string>")
([&, configuration](string passwordResetKey) {
crow::mustache::context ctx;
pqxx::connection databaseConnection(configuration.databaseConnectionString);
pqxx::result freelancerEmail = Database::executePreparedStatement_SELECT_FREELANCER_EMAIL_FROM_PASSWORD_RESET_KEY(databaseConnection, passwordResetKey);
if (!freelancerEmail.empty()) {
ctx["freelanceremail"] = freelancerEmail.at(0).at(0).c_str();
ctx["passwordresetkey"] = passwordResetKey;
}
else {
ctx["PASSWORD_RESET_DOES_NOT_EXIST"] = true;
}
auto page = crow::mustache::load("passwordReset.html");
return page.render(ctx);
});
/*
* Page for freelancer to log in fulfillment
*/