From 28b6a088b7a8bd2d73a25cf7b08383ad97abdc9d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 5 Sep 2011 02:03:37 -0400 Subject: 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 --- src/controllers/Users.class.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/controllers') 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 -- cgit v1.2.3-2-g168b