Modified password validation to reject spaces in passwords. refs #1256
Showing
1 changed file
with
6 additions
and
1 deletions
| ... | @@ -27,7 +27,7 @@ const OPTION_NAME = 'tz_auth'; // Database lookup key (`wp_options`.`option_name | ... | @@ -27,7 +27,7 @@ const OPTION_NAME = 'tz_auth'; // Database lookup key (`wp_options`.`option_name |
| 27 | if (empty($wpdb->signups)) { | 27 | if (empty($wpdb->signups)) { |
| 28 | $wpdb->signups = $wpdb->prefix . 'signups'; | 28 | $wpdb->signups = $wpdb->prefix . 'signups'; |
| 29 | } | 29 | } |
| 30 | 30 | //die(var_dump(wp_hash_password('a '))); | |
| 31 | Vars::$options = new Tools\WP_Option(OPTION_NAME); | 31 | Vars::$options = new Tools\WP_Option(OPTION_NAME); |
| 32 | 32 | ||
| 33 | if (is_admin()) { | 33 | if (is_admin()) { |
| ... | @@ -255,12 +255,17 @@ class Validation extends Common\Validation { | ... | @@ -255,12 +255,17 @@ class Validation extends Common\Validation { |
| 255 | 255 | ||
| 256 | /** | 256 | /** |
| 257 | * @rule Not blank | 257 | * @rule Not blank |
| 258 | * @rule No spaces | ||
| 258 | * @returns Boolean | 259 | * @returns Boolean |
| 259 | */ | 260 | */ |
| 260 | protected function password($val) { | 261 | protected function password($val) { |
| 261 | if (empty($val)) { | 262 | if (empty($val)) { |
| 262 | throw new Exception('<li>Password can not be blank</li>'); | 263 | throw new Exception('<li>Password can not be blank</li>'); |
| 263 | } | 264 | } |
| 265 | |||
| 266 | if (false !== strpos($val, ' ')) { | ||
| 267 | throw new Exception('<li>Password can not contain spaces</li>'); | ||
| 268 | } | ||
| 264 | } | 269 | } |
| 265 | 270 | ||
| 266 | /** | 271 | /** | ... | ... |
-
Please register or sign in to post a comment