diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-30 18:26:21 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-30 18:26:21 -0400 |
commit | 50bbd4a6a7294546c0fe3c455f4c728e5d0701d0 (patch) | |
tree | 24a34e790ee7f28cd05104acdda984c705664d07 /src/controllers/Users.class.php | |
parent | 74f3131207496cd2351b828faead37bfa319d024 (diff) |
Move username validation from the Users controller to the Auth model.
Diffstat (limited to 'src/controllers/Users.class.php')
-rw-r--r-- | src/controllers/Users.class.php | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php index c30461f..1d947e1 100644 --- a/src/controllers/Users.class.php +++ b/src/controllers/Users.class.php @@ -8,8 +8,6 @@ Router::register('users' , 'Users', 'index_dir'); Router::register('users/*' , 'Users', 'individual'); class Users extends Controller { - public static $illegal_names = array('', 'new', 'index'); - // Index Views /////////////////////////////////////////////// public function index($routed, $remainder) { @@ -143,7 +141,7 @@ class Users extends Controller { $vars['errors'] = array(); if ($db->getUID($vars['username'])!==false) $vars['errors'][] = 'user exists'; - if (in_array($vars['username'], self::$illegal_names)) + if (!Auth::isNameLegal($vars['username'])) $vars['errors'][] = 'illegal name'; $matches = ($vars['password1'] == $vars['password2']); if (!$matches) { @@ -187,11 +185,9 @@ class Users extends Controller { if (isset($_POST['auth_name'])) { $new_name = $_POST['auth_name']; if ($new_name != $username) { - if (!in_array($new_name, $this->illegal_names)) { - $changed_name = $user->setName($new_name); - $username = $user->getName(); - $vars['changed name'] = $changed_name; - } + $changed_name = $user->setName($new_name); + $username = $user->getName(); + $vars['changed name'] = $changed_name; } } |