Merge branch 'marijn-settings' into 'master'
Email confirm on settings page and emailconfirm fix (: See merge request !116
This commit was merged in pull request #120.
This commit is contained in:
@@ -25,7 +25,9 @@ function sendConfirmEmail(int $userID) {
|
|||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":userID", $userID);
|
$stmt->bindParam(":userID", $userID);
|
||||||
|
$stmt->execute();
|
||||||
$user = $stmt->fetch();
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
$email = $user["email"];
|
$email = $user["email"];
|
||||||
@@ -34,10 +36,7 @@ function sendConfirmEmail(int $userID) {
|
|||||||
$confirmLink = "https://myhyvesbookplus.nl/emailconfirm.php?u=$userID&h=$hash";
|
$confirmLink = "https://myhyvesbookplus.nl/emailconfirm.php?u=$userID&h=$hash";
|
||||||
|
|
||||||
$subject = "Bevestig uw emailadres";
|
$subject = "Bevestig uw emailadres";
|
||||||
$body = "Hallo $fname,\r\n\r\n
|
$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+";
|
||||||
Klik op de onderstaande link om uw emailadres te bevestigen.\r\n\r\n
|
|
||||||
$confirmLink\r\n\r\n
|
|
||||||
Groeten MyHyvesbook+";
|
|
||||||
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
|
$header = "From: MyHyvesbook+ <noreply@myhyvesbookplus.nl>";
|
||||||
mail($email, $subject, $body, $header);
|
mail($email, $subject, $body, $header);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
include_once "../queries/emailconfirm.php";
|
||||||
|
|
||||||
abstract class AlertMessage extends Exception {
|
abstract class AlertMessage extends Exception {
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
{
|
{
|
||||||
@@ -152,7 +154,7 @@ function emailIsAvailableInDatabase($email) {
|
|||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`email` = :email
|
`email` = :email
|
||||||
");
|
");
|
||||||
|
|
||||||
@@ -168,16 +170,18 @@ function doChangeEmail($email) {
|
|||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
`email` = :email
|
`email` = :email,
|
||||||
|
`role` = 'unconfirmed'
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
$stmt->bindParam(":email", $email);
|
$stmt->bindParam(":email", $email);
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
// return $stmt->rowCount();
|
|
||||||
|
|
||||||
if ($stmt->rowCount()) {
|
if ($stmt->rowCount()) {
|
||||||
|
sendConfirmEmail($_SESSION["userID"]);
|
||||||
|
session_destroy();
|
||||||
throw new HappyAlert("Emailadres is veranderd.");
|
throw new HappyAlert("Emailadres is veranderd.");
|
||||||
} else {
|
} else {
|
||||||
throw new AngryAlert();
|
throw new AngryAlert();
|
||||||
|
|||||||
Reference in New Issue
Block a user