diff --git a/public/static/js/signup.js b/public/static/js/signup.js index 4031b32..91836f6 100644 --- a/public/static/js/signup.js +++ b/public/static/js/signup.js @@ -14,6 +14,9 @@ if (this.response.error) { var errorText; switch (this.response.error) { + case 'email_not_valid': + errorText = 'The given email address is not valid.' + break; case 'passwords_too_short': errorText = 'The given password is too short. Please choose a password that is at least 6 characters long!' break; diff --git a/src/Controller/SignupController.php b/src/Controller/SignupController.php index ea049bc..b50bfe2 100644 --- a/src/Controller/SignupController.php +++ b/src/Controller/SignupController.php @@ -43,6 +43,11 @@ class SignupController return new JsonContent($data); } + if (filter_var($this->request->post('email'), FILTER_VALIDATE_EMAIL) === false) { + $data = ['error' => 'email_not_valid']; + return new JsonContent($data); + } + $select = new Select(\Container::$dbConnection, 'users'); $select->columns(User::getFields()); $select->where('email', '=', $this->request->post('email')); diff --git a/views/login.php b/views/login.php index 4d74970..1dfdd94 100644 --- a/views/login.php +++ b/views/login.php @@ -9,8 +9,8 @@ $jsFiles = [

Login

- - + +

diff --git a/views/profile.php b/views/profile.php index dc96db1..7154c8c 100644 --- a/views/profile.php +++ b/views/profile.php @@ -11,8 +11,8 @@ $jsFiles = [ - - + +

diff --git a/views/signup/signup.php b/views/signup/signup.php index e6be4e4..c2c12bc 100644 --- a/views/signup/signup.php +++ b/views/signup/signup.php @@ -9,9 +9,9 @@ $jsFiles = [

Sign up

- - - + + +