X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttRegistrator.class.php;h=1664461b86ce9c35267cf5cdb88340b9987cf980;hb=a4697cccdffc187c38d6560c5824fe344e59f5be;hp=8e755837e48248c134e010cbe43c167db5326a2f;hpb=725af06a89e5a7014dfdc9081222f313a58a6bb6;p=timetracker.git diff --git a/WEB-INF/lib/ttRegistrator.class.php b/WEB-INF/lib/ttRegistrator.class.php index 8e755837..1664461b 100644 --- a/WEB-INF/lib/ttRegistrator.class.php +++ b/WEB-INF/lib/ttRegistrator.class.php @@ -26,6 +26,9 @@ // | https://www.anuko.com/time_tracker/credits.htm // +----------------------------------------------------------------------+ +import('ttUserHelper'); +import('ttRoleHelper'); + // ttRegistrator class is used to register a user in Time Tracker. class ttRegistrator { var $user_name = null; // User name. @@ -67,7 +70,7 @@ class ttRegistrator { function validate() { global $i18n; - if (!ttValidString($this->group_name, true)) + if (!ttValidString($this->group_name)) $this->err->add($i18n->get('error.field'), $i18n->get('label.group_name')); if (!ttValidString($this->currency, true)) $this->err->add($i18n->get('error.field'), $i18n->get('label.currency')); @@ -83,6 +86,8 @@ class ttRegistrator { $this->err->add($i18n->get('error.not_equal'), $i18n->get('label.password'), $i18n->get('label.confirm_password')); if (!ttValidEmail($this->email, true)) $this->err->add($i18n->get('error.field'), $i18n->get('label.email')); + if (!ttUserHelper::canAdd()) + $this->err->add($i18n->get('error.user_count')); } // The register function registers a user in Time Tracker. @@ -115,7 +120,6 @@ class ttRegistrator { return false; } - import('ttRoleHelper'); if (!ttRoleHelper::createPredefinedRoles($this->group_id, $this->lang)) { $err->add($i18n->get('error.db')); return false; @@ -124,7 +128,7 @@ class ttRegistrator { $this->user_id = $this->createUser(); if (!$this->user_id) { - $err->add($i18n->get('error.db')); + $this->err->add($i18n->get('error.db')); return false; }