Commit 177999b2 authored by Michael Ochmann's avatar Michael Ochmann
Browse files

added email sanitazation

parent 0b1158fa
......@@ -31,6 +31,11 @@ class NewRegistration extends Register {
$this->model->error = "Die Passwörter stimmen nicht überein.";
$this->render();
return false;
} elseif (!self::ValidateEmail($_POST["email"])) {
$this->model->error = "Bitte eine gültige E-Mail-Adresse angeben";
$this->render();
return false;
}
$db = $services[\niv\services\Database::class];
......@@ -102,4 +107,8 @@ class NewRegistration extends Register {
return true;
}
private static function ValidateEmail(string $email) {
return preg_match("/^[a-zA-Z0-9.!#$%&’*+=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/", $email) === 1;
}
}
......@@ -11,7 +11,7 @@
<section class="frame">
<input type="text" name="lastname" placeholder="Name" required />
<input type="text" name="firstname" placeholder="Vorname" required/>
<input type="text" name="email" placeholder="E-Mail" required/>
<input type="email" name="email" placeholder="E-Mail" required/>
<input type="password" name="password" placeholder="Passwort" required/>
<input type="password" name="password_repeat" placeholder="Passwort wiederholen" required/>
<p>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment