diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-05 02:03:37 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2011-09-05 02:03:37 -0400 |
commit | 28b6a088b7a8bd2d73a25cf7b08383ad97abdc9d (patch) | |
tree | e2ef4a9982dcb846fc18cbbd673a1112dd856515 /src/controllers | |
parent | 570901ba4e526be37afd0cbbe018cb0500a7cda1 (diff) |
Fix a few growing pains
* Users.class.php: whitespace change, fix a few array things
* Database.class.php: refer to $mm->hasher(), not $this->hasher()
* new.html.php: fix stupid shit
Diffstat (limited to 'src/controllers')
-rw-r--r-- | src/controllers/Users.class.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php index 9674907..4a8f04c 100644 --- a/src/controllers/Users.class.php +++ b/src/controllers/Users.class.php @@ -59,6 +59,7 @@ class Users extends Controller { public function new_user($routed, $vars) { // since there will never be a remainder to `users/new', we can // use that parameter to pass in some data. + if (!isset($vars['errors'])) $vars['errors'] = array(); $this->showView('users/new', $vars); } @@ -124,7 +125,7 @@ class Users extends Controller { */ private function create_user() { $vars = array(); - @$vars['username' ] = $_POST['auth_name']; + @$vars['username' ] = $_POST['auth_name']; @$vars['password1'] = $_POST['auth_password' ]; @$vars['password2'] = $_POST['auth_password_verify']; @@ -133,14 +134,16 @@ class Users extends Controller { $vars['errors'] = array(); if ($db->getUID($vars['username'])!==false) $vars['errors'][] = 'user exists'; - if (in_array($vars['username'], $this->illegal_names)) - $vars['errors'] = 'illegal name'; + if (in_array($vars['username'], self::$illegal_names)) + $vars['errors'][] = 'illegal name'; $matches = ($vars['password1'] == $vars['password2']); - if (!$matches) - $vars['errors'] = 'pw mixmatch'; - if ($matches && $password2 == '') - $vars['errors'] = 'no pw'; - + if (!$matches) { + $vars['errors'][] = 'pw mixmatch'; + } + if ($matches && $vars['password2'] == '') { + $vars['errors'][] = 'no pw'; + } + if (count($vars['errors']) > 0) { $this->new_user($routed, $vars); } else { @@ -155,7 +158,7 @@ class Users extends Controller { array('username'=>$username)); } } - } + } /** * This will parse POST (really, PUT) data to update a single user |