diff --git a/website/public/logout.php b/website/public/logout.php index 6a2ba5d..de4d7c2 100644 --- a/website/public/logout.php +++ b/website/public/logout.php @@ -1,15 +1,4 @@ - - -
- - - +session_start(); +session_destroy(); +header("Location: login.php"); \ No newline at end of file diff --git a/website/public/resetpassword.php b/website/public/resetpassword.php new file mode 100644 index 0000000..c2f9221 --- /dev/null +++ b/website/public/resetpassword.php @@ -0,0 +1,49 @@ +prepare(" + UPDATE + `user` + SET + `password` = :password + WHERE + `userID` = :userID + "); + $stmt->bindParam(":password", $_POST["password"]); + $stmt->bindParam(":userID", $_POST["u"]); + $stmt->execute(); +} + +function verifyLink(int $userID, string $hash) { + $stmt = $GLOBALS["db"]->prepare(" + SELECT + `password` + FROM + `user` + WHERE + `userID` = :userID + "); + $stmt->bindParam(":userID", $userID); + $password = $stmt->fetch()["password"]; + return password_verify($password, $hash); +} \ No newline at end of file diff --git a/website/public/styles/resetpassword.css b/website/public/styles/resetpassword.css new file mode 100644 index 0000000..a3d7942 --- /dev/null +++ b/website/public/styles/resetpassword.css @@ -0,0 +1,17 @@ +.password-change { + height: 100%; + background-color: #FBC02D; + margin: auto; +} + +.top-logo { + text-align: center; +} + +.item-box { + margin: 30px auto auto; + display: block; +} +.password-change img { + width: 50%; +} diff --git a/website/queries/emailconfirm.php b/website/queries/emailconfirm.php index 583a47b..0b3224f 100644 --- a/website/queries/emailconfirm.php +++ b/website/queries/emailconfirm.php @@ -25,7 +25,9 @@ function sendConfirmEmail(int $userID) { WHERE `userID` = :userID "); + $stmt->bindParam(":userID", $userID); + $stmt->execute(); $user = $stmt->fetch(); $email = $user["email"]; @@ -34,10 +36,7 @@ function sendConfirmEmail(int $userID) { $confirmLink = "https://myhyvesbookplus.nl/emailconfirm.php?u=$userID&h=$hash"; $subject = "Bevestig uw emailadres"; - $body = "Hallo $fname,\r\n\r\n - Klik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n - $confirmLink\r\n\r\n - Groeten MyHyvesbook+"; + $body = "Hallo $fname,\r\n\r\nKlik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n$confirmLink\r\n\r\nGroeten MyHyvesbook+"; $header = "From: MyHyvesbook+