summaryrefslogtreecommitdiff
path: root/src/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/Users.class.php21
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