passwort ok

This commit is contained in:
2023-02-10 01:15:55 +01:00
parent e3e99e67f9
commit 26a4dc11c7
6 changed files with 116 additions and 15 deletions

View File

@ -22,18 +22,20 @@ require __DIR__.'/classes/lib.php';
$db_connection = new Database();
$conn = $db_connection->dbConnection();
function updatePwtoken($email, $pwtoken)
{
global $conn;
$sql = "UPDATE dogs SET pwtoken=? WHERE email=?";
$conn->prepare($sql)->execute([$pwtoken, $email]);
$now = new DateTime();
$sql = "UPDATE dogs SET pwtoken=?, pwt_time=? WHERE email=?";
$conn->prepare($sql)->execute([$pwtoken, $now->format('Y-m-d H:i:s'), $email]);
}
function sendMail($email, $pwtoken)
{
global $G_pwtoken_time_expire;
$expires = new DateTime();
$expires->add(new DateInterval('PT' . $G_pwtoken_time_expire . 'M'));
$expiresStr = $expires->format('d.m.Y H:i:s');
$mail = new CNetcupMailer();
$mail->CharSet = "UTF-8";
@ -45,7 +47,10 @@ function sendMail($email, $pwtoken)
//Content
$mail->Subject = 'Passwort zurücksetzen!';
$mail->Body = '<h3>Neues Passwort setzen</h3><a href="https://hope-fly.de/dog/pwreset/'.$pwtoken.'" >Setzen</a>';
$mail->Body =
"<h3>Neues Passwort setzen</h3>
<p>Gültig bis $expiresStr</p>
<a href='https://hope-fly.de/dog/pwreset/$pwtoken'>Setzen</a>";
return $mail->send();
}