database request to delete a reset key
This commit is contained in:
@ -144,6 +144,12 @@ namespace Database {
|
|||||||
const static std::string PREPARED_STATEMENT_INSERT_FREELANCER_RESET_KEY = "insertFreelancerResetKey";
|
const static std::string PREPARED_STATEMENT_INSERT_FREELANCER_RESET_KEY = "insertFreelancerResetKey";
|
||||||
const static std::string SQL_STATEMENT_INSERT_FREELANCER_RESET_KEY = "insert into passwordresetkeys values ($1, $2, CURRENT_TIMESTAMP);";
|
const static std::string SQL_STATEMENT_INSERT_FREELANCER_RESET_KEY = "insert into passwordresetkeys values ($1, $2, CURRENT_TIMESTAMP);";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name and Statement for prepared statement to delete specific reset key of a freelancer
|
||||||
|
*/
|
||||||
|
const static std::string PREPARED_STATEMENT_DELETE_FREELANCER_RESET_KEY = "deleteFreelancerResetKey";
|
||||||
|
const static std::string SQL_STATEMENT_DELETE_FREELANCER_RESET_KEY = "delete from passwordresetkeys where freelanceremail = $1;";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Statement to remove expired reset keys
|
* Statement to remove expired reset keys
|
||||||
*/
|
*/
|
||||||
@ -599,6 +605,17 @@ namespace Database {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deletes the entry for a reset key based on a freelancer email
|
||||||
|
* Takes an open pqxx::connection and the freelancers email
|
||||||
|
*/
|
||||||
|
void executePreparedStatement_DELETE_FREELANCER_RESET_KEY(pqxx::connection &connection, const std::string& freelancerEmail) {
|
||||||
|
connection.prepare(PREPARED_STATEMENT_DELETE_FREELANCER_RESET_KEY, SQL_STATEMENT_DELETE_FREELANCER_RESET_KEY);
|
||||||
|
pqxx::work work(connection);
|
||||||
|
work.exec_prepared(PREPARED_STATEMENT_DELETE_FREELANCER_RESET_KEY, freelancerEmail);
|
||||||
|
work.commit();
|
||||||
|
connection.unprepare(PREPARED_STATEMENT_DELETE_FREELANCER_RESET_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates a new entry for a password reset key for a freelancer
|
* Creates a new entry for a password reset key for a freelancer
|
||||||
|
Reference in New Issue
Block a user