[Server] Serve password reset from the database interface (#7842)

cmdForgotPasswordRequest, continuePasswordRequest, cmdForgotPasswordReset,
cmdForgotPasswordChallenge, cmdRequestPasswordSalt and cmdSubmitPasswordVerifier
still called Servatrice_DatabaseInterface, and two of them validated the account
token and email through the generic validateTableColumnStringData helper. Add
doesForgotPasswordExist, addForgotPassword and getUsableLegacyBackup to
Server_DatabaseInterface with fail-closed defaults, replace the table/column
probes with userTokenMatches and userEmailMatches using the same statement and
case-insensitive comparison, and let the commands ask the injected interface.
Audit records, check order and every response code are unchanged.
This commit is contained in:
BruebachL 2026-11-10 12:16:26 +01:00 • committed by GitHub
parent d05198101d
commit 9b00972b4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 54 additions and 18 deletions

View file

@ -87,7 +87,7 @@ public:
/** @brief Decrypt the account's legacy password backup when it exists, is decryptable
* with the configured key and has not aged out; purges it when it has. Returns the
* legacy credential in the stored "salt + hash" format, or an empty string. */
QString getUsableLegacyBackup(const QString &user);
QString getUsableLegacyBackup(const QString &user) override;
/** @brief Refresh the age window of the account's legacy password backup. */
void touchLegacyBackup(const QString &user);
/** @brief Drop the account's legacy password backup. */
@ -273,9 +273,11 @@ public:
RemoveUserBannerResult removeUserBanner(const QString &userName);
int clearBlacklistedBanners();
bool isCardArtAllowed(const QString &cardName, const QString &cardProviderId) override;
bool addForgotPassword(const QString &user);
bool addForgotPassword(const QString &user) override;
bool removeForgotPassword(const QString &user) override;
bool doesForgotPasswordExist(const QString &user);
bool doesForgotPasswordExist(const QString &user) override;
bool userTokenMatches(const QString &userName, const QString &token) override;
bool userEmailMatches(const QString &userName, const QString &email) override;
bool updateUserToken(const QString &token, const QString &user);
bool validateTableColumnStringData(const QString &table,
const QString &column,