X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/9eee35c738a83c870e8d6dfda19d859bd063b233..2ccee198591bc2ad5d80b5e1076246449d9232c1:/WEB-INF/lib/ttRegistrator.class.php diff --git a/WEB-INF/lib/ttRegistrator.class.php b/WEB-INF/lib/ttRegistrator.class.php new file mode 100644 index 00000000..9a650c9c --- /dev/null +++ b/WEB-INF/lib/ttRegistrator.class.php @@ -0,0 +1,83 @@ +user_name = $fields['user_name']; + $this->login = $fields['login']; + $this->password1 = $fields['password1']; + $this->password2 = $fields['password2']; + $this->email = $fields['email']; + $this->group_name = $fields['group_name']; + $this->currency = $fields['currency']; + $this->lang = $fields['lang']; + if (!$thins->lang) $this->lang = 'en'; + $this->err = $err; + + // Validate passed in parameters. + $this->validate(); + } + + function validate() { + global $i18n; + + if (!ttValidString($this->group_name, true)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.team_name')); + if (!ttValidString($this->currency, true)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.currency')); + if (!ttValidString($this->user_name)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_name')); + if (!ttValidString($this->login)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.manager_login')); + if (!ttValidString($this->password1)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.password')); + if (!ttValidString($this->password2)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.confirm_password')); + if ($this->password1 !== $this->password2) + $this->err->add($i18n->getKey('error.not_equal'), $i18n->getKey('label.password'), $i18n->getKey('label.confirm_password')); + if (!ttValidEmail($this->email, true)) + $this->err->add($i18n->getKey('error.field'), $i18n->getKey('label.email')); + } + + // The register function registers a user in Time Tracker. + function register() { + // TODO: work in progress. Not implemented. + } +}