MAPG-151 check email address validity on server side

This commit is contained in:
Bence Pőcze 2020-06-18 16:12:40 +02:00
parent efccb2dcc5
commit 50c7e3972c
2 changed files with 8 additions and 0 deletions

View File

@ -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;

View File

@ -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'));