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