Skip to content

Commit

Permalink
fix password reset
Browse files Browse the repository at this point in the history
  • Loading branch information
ellite committed May 26, 2024
1 parent c18879b commit 7ed4298
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion endpoints/cronjobs/sendresetpasswordemails.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

$mail->clearAddresses();

echo "Verification email sent to " . $user['email'] . "<br>";
echo "Password reset email sent to " . $user['email'] . "<br>";

}
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo} <br>";
Expand Down
7 changes: 4 additions & 3 deletions passwordreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
$requestMode = false;
$resetMode = true;
$token = $_GET['token'];
$email = $_GET['email'];
$matchCount = "SELECT COUNT(*) FROM password_resets WHERE token = :token and email = :email";
$stmt = $db->prepare($matchCount);
$stmt->bindValue(':token', $token, SQLITE3_TEXT);
$stmt->bindValue(':email', $_GET['email'], SQLITE3_TEXT);
$stmt->bindValue(':email', $email, SQLITE3_TEXT);
$count = $stmt->execute()->fetchArray(SQLITE3_NUM);
if ($count[0] == 0) {
$hasErrorMessage = true;
Expand Down Expand Up @@ -168,8 +169,8 @@
if (!$hideForm) {
?>
<div class="form-group">
<input type="hidden" name="token" value="<?= $_GET['token'] ?>">
<input type="hidden" name="email" value="<?= $_GET['email'] ?>">
<input type="hidden" name="token" value="<?= $token ?>">
<input type="hidden" name="email" value="<?= $email ?>">
<label for="password"><?= translate('password', $i18n) ?>:</label>
<input type="password" id="password" name="password" required>
</div>
Expand Down

0 comments on commit 7ed4298

Please sign in to comment.