Email confirm and password change now use messagepage function. #131
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
include_once("../queries/connect.php");
|
||||
include_once("../views/messagepage.php");
|
||||
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||
$checkHash = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
@@ -18,11 +19,11 @@ if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||
if ($role == "unconfirmed") {
|
||||
doActivate($email);
|
||||
} else {
|
||||
echo "Ongeldige link.";
|
||||
messagePage("Ongeldige link.");
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Ongeldige link.";
|
||||
messagePage("Ongeldige link.");
|
||||
}
|
||||
|
||||
function doActivate(string $email) {
|
||||
@@ -39,11 +40,10 @@ function doActivate(string $email) {
|
||||
$confirmUser->bindParam(":userID", $_GET["u"]);
|
||||
$confirmUser->execute();
|
||||
if ($confirmUser->rowCount()) {
|
||||
echo "Email bevestigd <br />
|
||||
<a href='index.php'>U wordt automatisch doorgestuurd naar de login pagina over 5 seconden.</a> ";
|
||||
header("refresh:5;url=login.php");
|
||||
messagePage("Email bevestigd <br />
|
||||
<a href='index.php'>Klik hier om terug te gaan naar de login pagina.</a>");
|
||||
}
|
||||
} else {
|
||||
echo "Ongeldige link.";
|
||||
messagePage("Ongeldige link.");
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,30 @@
|
||||
<?php
|
||||
include_once("../queries/connect.php");
|
||||
include_once("../views/messagepage.php");
|
||||
include_once("../views/resetpassword.php");
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||
if (array_key_exists("u", $_GET) and array_key_exists("h", $_GET)) {
|
||||
if (verifyLink($_GET["u"], $_GET["h"])) {
|
||||
include "../views/resetpassword.php";
|
||||
messagePage(passwordResetFields());
|
||||
} else {
|
||||
echo "Ongeldige link.";
|
||||
messagePage("Wachtwoorden komen niet overeen.");
|
||||
}
|
||||
} else {
|
||||
echo "Ongeldige link.";
|
||||
messagePage("Ongeldige links");
|
||||
}
|
||||
} elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if (verifyLink($_POST["u"], $_POST["h"])) {
|
||||
if ($_POST["password"] == $_POST["password-confirm"]) {
|
||||
changePassword();
|
||||
echo "Wachtwoord is veranderd";
|
||||
messagePage("Wachtwoord gewijzigd");
|
||||
} else {
|
||||
echo "Wachtwoorden zijn niet hetzelfde";
|
||||
messagePage("Ongeldige link");
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "Ongeldige link.";
|
||||
messagePage("Ongeldige link");
|
||||
|
||||
}
|
||||
|
||||
function changePassword() {
|
||||
|
||||
23
website/views/messagepage.php
Normal file
23
website/views/messagepage.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
function messagePage(string $content) {
|
||||
$webpage = ("
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
@import url(styles/main.css);
|
||||
@import url(styles/settings.css);
|
||||
@import url(styles/resetpassword.css);
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='password-change'>
|
||||
<div class='top-logo'><a href='login.php'><img src='img/top-logo.png' alt='MyHyvesbook+'/></a></div>
|
||||
<div class='item-box platform'>$content</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
");
|
||||
|
||||
echo $webpage;
|
||||
}
|
||||
@@ -1,47 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
@import url(styles/main.css);
|
||||
@import url(styles/settings.css);
|
||||
@import url(styles/resetpassword.css);
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='password-change'>
|
||||
<div class="top-logo"><img src="img/top-logo.png" alt="MyHyvesbook+"/></div>
|
||||
|
||||
<form class='settings platform item-box' method='post'>
|
||||
<h5>Voer een nieuw wachtwoord in</h5>
|
||||
<input type="hidden"
|
||||
name="u"
|
||||
value="<?=$_GET["u"]?>"
|
||||
<?php
|
||||
function passwordResetFields() {
|
||||
$username = $_GET['u'];
|
||||
$hash = $_GET['h'];
|
||||
$content ="
|
||||
<form class='settings' method = 'post' >
|
||||
<h5 > Voer een nieuw wachtwoord in </h5 >
|
||||
<input type = 'hidden'
|
||||
name = 'u'
|
||||
value = '$username'
|
||||
>
|
||||
<input type="hidden"
|
||||
name="h"
|
||||
value="<?=$_GET["h"]?>"
|
||||
<input type = 'hidden'
|
||||
name = 'h'
|
||||
value = '$hash'
|
||||
>
|
||||
<ul>
|
||||
<li>
|
||||
<label>Nieuw wachtwoord</label>
|
||||
<input type='password'
|
||||
name='password'
|
||||
placeholder='Nieuw wachtwoord'
|
||||
<ul >
|
||||
<li >
|
||||
<label > Nieuw wachtwoord </label >
|
||||
<input type = 'password'
|
||||
name = 'password'
|
||||
placeholder = 'Nieuw wachtwoord'
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<label>Bevestig wachtwoord</label>
|
||||
<input type='password'
|
||||
name='password-confirm'
|
||||
placeholder='Bevestig wachtwoord'
|
||||
</li >
|
||||
<li >
|
||||
<label > Bevestig wachtwoord </label >
|
||||
<input type = 'password'
|
||||
name = 'password-confirm'
|
||||
placeholder = 'Bevestig wachtwoord'
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<label></label>
|
||||
<button type='submit'>Verander wachtwoord</button>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</li >
|
||||
<li >
|
||||
<label ></label >
|
||||
<button type = 'submit' > Verander wachtwoord </button >
|
||||
</li >
|
||||
</ul >
|
||||
</form >";
|
||||
return $content;
|
||||
}
|
||||
Reference in New Issue
Block a user