Fixed reset password
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
include_once("../queries/checkInput.php");
|
include_once("../queries/checkInput.php");
|
||||||
include_once("../queries/emailconfirm.php");
|
include_once("../queries/emailconfirm.php");
|
||||||
include_once("../queries/requestpassword.php");
|
include_once("../queries/requestpassword.php");
|
||||||
|
include_once("../queries/register.php");
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
break;
|
break;
|
||||||
case "reset":
|
case "reset":
|
||||||
try {
|
try {
|
||||||
// validateEmail($_POST["forgotEmail"]);
|
resetEmail($_POST["forgotEmail"]);
|
||||||
sendPasswordRecovery($_POST["forgotEmail"]);
|
sendPasswordRecovery($_POST["forgotEmail"]);
|
||||||
} catch (emailException $e){
|
} catch (emailException $e){
|
||||||
$resetErr = $e->getMessage();
|
$resetErr = $e->getMessage();
|
||||||
|
|||||||
@@ -97,6 +97,18 @@ function validateEmail($variable){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* checks if an input is a valid email. */
|
||||||
|
function resetEmail($variable){
|
||||||
|
if (empty($variable)) {
|
||||||
|
throw new emailException("Verplicht!");
|
||||||
|
} else if (!filter_var($variable, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
throw new emailException("Geldige email invullen");
|
||||||
|
} else if (getResetEmail() == 0){
|
||||||
|
throw new emailException("Email bestaat niet!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* checks if two passwords matches. */
|
/* checks if two passwords matches. */
|
||||||
function matchPassword(){
|
function matchPassword(){
|
||||||
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
||||||
|
|||||||
@@ -32,6 +32,22 @@ function getExistingEmail() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getResetEmail() {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`email`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` LIKE :email
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":email", $_POST["forgotEmail"]);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function registerAccount() {
|
function registerAccount() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
|
|||||||
Reference in New Issue
Block a user