4b42459c by Jeff Balicki

error

1 parent 6d4998ff
...@@ -240,18 +240,18 @@ class Validation extends Common\Validation { ...@@ -240,18 +240,18 @@ class Validation extends Common\Validation {
240 */ 240 */
241 protected function username($val) { 241 protected function username($val) {
242 if (empty($val)) { 242 if (empty($val)) {
243 throw new Exception('<li>'.__('Username is blank', 'CBV_DOMAIN').'</li>'); 243 throw new Exception('<li class="error-mess" data-error="username">'.__('Username is blank', 'CBV_DOMAIN').'</li>');
244 } 244 }
245 245
246 require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'registration.php'); 246 require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'registration.php');
247 if (!validate_username($val)) { 247 if (!validate_username($val)) {
248 throw new Exception( 248 throw new Exception(
249 '<li>'.__('Username must be at least 4 characters, letters and numbers only', 'CBV_DOMAIN').'</li>' 249 '<li class="error" data-error="username">'.__('Username must be at least 4 characters, letters and numbers only', 'CBV_DOMAIN').'</li>'
250 ); 250 );
251 } 251 }
252 252
253 if (username_exists($val)) { 253 if (username_exists($val)) {
254 throw new Exception('<li>'.__('Username already exists', 'CBV_DOMAIN').'</li>'); 254 throw new Exception('<li class="error-mess" data-error="username">'.__('Username already exists', 'CBV_DOMAIN').'</li>');
255 } 255 }
256 } 256 }
257 257
...@@ -262,18 +262,18 @@ class Validation extends Common\Validation { ...@@ -262,18 +262,18 @@ class Validation extends Common\Validation {
262 */ 262 */
263 protected function password($val) { 263 protected function password($val) {
264 if (empty($val)) { 264 if (empty($val)) {
265 throw new Exception('<li>'.__('Password can not be blank', 'CBV_DOMAIN').'</li>'); 265 throw new Exception('<li class="error-mess" data-error="password">'.__('Password can not be blank', 'CBV_DOMAIN').'</li>');
266 } 266 }
267 267
268 if (isset($val[PASS_MAX_LEN])) { 268 if (isset($val[PASS_MAX_LEN])) {
269 throw new Exception( 269 throw new Exception(
270 '<li>'.sprintf(__('Password can not be longer than %d characters.', 'CBV_DOMAIN'), PASS_MAX_LEN).'</li>' 270 '<li class="error-mess" data-error="password">'.sprintf(__('Password can not be longer than %d characters.', 'CBV_DOMAIN'), PASS_MAX_LEN).'</li>'
271 ); 271 );
272 } 272 }
273 273
274 if (preg_match('/(\\\\|\\\'|"| )+/i', $val)) { 274 if (preg_match('/(\\\\|\\\'|"| )+/i', $val)) {
275 throw new Exception( 275 throw new Exception(
276 '<li>'.__('Password can not contain spaces, backslashes (\) or quotes', 'CBV_DOMAIN').'</li>' 276 '<li class="error-mess" data-error="password">'.__('Password can not contain spaces, backslashes (\) or quotes', 'CBV_DOMAIN').'</li>'
277 ); 277 );
278 } 278 }
279 } 279 }
...@@ -284,11 +284,11 @@ class Validation extends Common\Validation { ...@@ -284,11 +284,11 @@ class Validation extends Common\Validation {
284 */ 284 */
285 protected function email($val) { 285 protected function email($val) {
286 if (!(boolean)filter_var($val, FILTER_VALIDATE_EMAIL)) { 286 if (!(boolean)filter_var($val, FILTER_VALIDATE_EMAIL)) {
287 throw new Exception('<li>'.__('Invalid email address', 'CBV_DOMAIN').'</li>'); 287 throw new Exception('<li class="error-mess" data-error="email">'.__('Invalid email address', 'CBV_DOMAIN').'</li>');
288 } 288 }
289 289
290 if (false !== email_exists($val)) { 290 if (false !== email_exists($val)) {
291 throw new Exception('<li>'.__('Email address already registered', 'CBV_DOMAIN').' </li > '); 291 throw new Exception('<li class="error-mess" data-error="email">'.__('Email address already registered', 'CBV_DOMAIN').' </li > ');
292 } 292 }
293 } 293 }
294 } 294 }
......