Merged in bugfix/MAPG-151-check-email-address-validity-on (pull request #116)
Bugfix/MAPG-151 check email address validity on
This commit is contained in:
		
						commit
						a8913b0d44
					
				| @ -14,6 +14,9 @@ | |||||||
|             if (this.response.error) { |             if (this.response.error) { | ||||||
|                 var errorText; |                 var errorText; | ||||||
|                 switch (this.response.error) { |                 switch (this.response.error) { | ||||||
|  |                     case 'email_not_valid': | ||||||
|  |                         errorText = 'The given email address is not valid.' | ||||||
|  |                         break; | ||||||
|                     case 'passwords_too_short': |                     case 'passwords_too_short': | ||||||
|                         errorText = 'The given password is too short. Please choose a password that is at least 6 characters long!' |                         errorText = 'The given password is too short. Please choose a password that is at least 6 characters long!' | ||||||
|                         break; |                         break; | ||||||
|  | |||||||
| @ -43,6 +43,11 @@ class SignupController | |||||||
|             return new JsonContent($data); |             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 = new Select(\Container::$dbConnection, 'users'); | ||||||
|         $select->columns(User::getFields()); |         $select->columns(User::getFields()); | ||||||
|         $select->where('email', '=', $this->request->post('email')); |         $select->where('email', '=', $this->request->post('email')); | ||||||
|  | |||||||
| @ -9,8 +9,8 @@ $jsFiles = [ | |||||||
|     <h2>Login</h2> |     <h2>Login</h2> | ||||||
|     <div class="box"> |     <div class="box"> | ||||||
|         <form id="loginForm" action="/login" method="post"> |         <form id="loginForm" action="/login" method="post"> | ||||||
|             <input class="big fullWidth" type="email" name="email" placeholder="Email address" autofocus> |             <input class="big fullWidth" type="email" name="email" placeholder="Email address" required autofocus> | ||||||
|             <input class="big fullWidth marginTop" type="password" name="password" placeholder="Password"> |             <input class="big fullWidth marginTop" type="password" name="password" placeholder="Password" required minlength="6"> | ||||||
|             <p id="loginFormError" class="formError justify marginTop"></p> |             <p id="loginFormError" class="formError justify marginTop"></p> | ||||||
|             <div class="right marginTop"> |             <div class="right marginTop"> | ||||||
|                 <button type="submit">Login</button> |                 <button type="submit">Login</button> | ||||||
|  | |||||||
| @ -11,8 +11,8 @@ $jsFiles = [ | |||||||
|         <form id="profileForm" action="/profile" method="post"> |         <form id="profileForm" action="/profile" method="post"> | ||||||
|             <?php /* TODO: disabled for the time being, email modification should be implemented */ ?>
 |             <?php /* TODO: disabled for the time being, email modification should be implemented */ ?>
 | ||||||
|             <input class="big fullWidth" type="email" name="email" placeholder="Email address" value="<?= $user['email'] ?>" disabled> |             <input class="big fullWidth" type="email" name="email" placeholder="Email address" value="<?= $user['email'] ?>" disabled> | ||||||
|             <input class="big fullWidth marginTop" type="password" name="password_new" placeholder="New password" autofocus> |             <input class="big fullWidth marginTop" type="password" name="password_new" placeholder="New password" minlength="6" autofocus> | ||||||
|             <input class="big fullWidth marginTop" type="password" name="password_new_confirm" placeholder="New password confirmation"> |             <input class="big fullWidth marginTop" type="password" name="password_new_confirm" placeholder="New password confirmation" minlength="6"> | ||||||
|             <hr> |             <hr> | ||||||
|             <input class="big fullWidth" type="password" name="password" placeholder="Current password"> |             <input class="big fullWidth" type="password" name="password" placeholder="Current password"> | ||||||
|             <p id="profileFormError" class="formError justify marginTop"></p> |             <p id="profileFormError" class="formError justify marginTop"></p> | ||||||
|  | |||||||
| @ -9,9 +9,9 @@ $jsFiles = [ | |||||||
|     <h2>Sign up</h2> |     <h2>Sign up</h2> | ||||||
|     <div class="box"> |     <div class="box"> | ||||||
|         <form id="signupForm" action="/signup" method="post"> |         <form id="signupForm" action="/signup" method="post"> | ||||||
|             <input class="big fullWidth" type="email" name="email" placeholder="Email address" autofocus> |             <input class="big fullWidth" type="email" name="email" placeholder="Email address" required autofocus> | ||||||
|             <input class="big fullWidth marginTop" type="password" name="password" placeholder="Password"> |             <input class="big fullWidth marginTop" type="password" name="password" placeholder="Password" required minlength="6"> | ||||||
|             <input class="big fullWidth marginTop" type="password" name="password_confirm" placeholder="Password confirmation"> |             <input class="big fullWidth marginTop" type="password" name="password_confirm" placeholder="Password confirmation" required minlength="6"> | ||||||
|             <p id="signupFormError" class="formError justify marginTop"></p> |             <p id="signupFormError" class="formError justify marginTop"></p> | ||||||
|             <div class="right marginTop"> |             <div class="right marginTop"> | ||||||
|                 <button type="submit">Sign up</button> |                 <button type="submit">Sign up</button> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user