Esempio n. 1
0
 $userEmail = filter_var($_POST['register_email'], FILTER_VALIDATE_EMAIL);
 $userPassword = trim(htmlspecialchars($_POST['register_password']));
 $userPasswordRt = trim(htmlspecialchars($_POST['register_password_rt']));
 $userEmailHash = md5(date('Y-m-d H:i:s'));
 try {
     /**
      * Check if all fields are filled.
      * todo: Need to add a better validation in the future, like allowing only strings etc
      */
     if (empty($userVoornaam) || empty($userFamilienaam) || empty($userEmail) || empty($userPassword) || empty($userPasswordRt)) {
         throw new AllFieldsAreRequiredException();
     }
     /**
      * Create user object
      */
     $obj = new UsersBusiness();
     /**
      * Check by email if user exists
      */
     $userControle = $obj->zoekGebruikerMetEmail($userEmail);
     if (!empty($userControle)) {
         throw new GebruikerBestaatException();
     }
     /**
      * Check both passwords are identical to each other
      */
     if ($userPassword !== $userPasswordRt) {
         throw new OngelijkeWachtwoordException();
     }
     /**
      * Hash password
Esempio n. 2
0
ob_start();
session_start();
require 'head.php';
use src\ProjectBrood\business\UsersBusiness;
use Doctrine\Common\ClassLoader;
use src\ProjectBrood\exceptions\OngeldigeAanvraagException;
if (isset($_GET['hash']) && !empty($_GET['hash'])) {
    try {
        require_once 'Doctrine/Common/ClassLoader.php';
        $classLoader = new ClassLoader("src");
        $classLoader->register();
        $userEmailHash = $_GET['hash'];
        /**
         * Create user object
         */
        $obj = new UsersBusiness();
        /**
         * Check by email hash if user exists
         */
        $userVerification = $obj->verifyUser($userEmailHash);
        if (empty($userVerification)) {
            throw new OngeldigeAanvraagException();
        }
    } catch (OngeldigeAanvraagException $e) {
        $userVerification[0] = "error";
    }
    /**
     * Load twig template for verification page
     */
    require_once "lib/Twig/Autoloader.php";
    Twig_Autoloader::register();