diff options
author | Brion Vibber <brion@pobox.com> | 2010-11-29 14:15:25 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-11-29 14:15:25 -0800 |
commit | dc350b5463e7d64a46d7f90143c2d001be99e280 (patch) | |
tree | bdf19094f16b2cfd35dac1ef309954e89ac3494b /actions/newgroup.php | |
parent | 6e249b4ab5aa292d78cfaa9be9dce8706e27ad80 (diff) |
Work in progress on nickname validation changes. lib/nickname.php appears to have been destroyed by NetBeans and will be rewritten shortly. Sigh.
Diffstat (limited to 'actions/newgroup.php')
-rw-r--r-- | actions/newgroup.php | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/actions/newgroup.php b/actions/newgroup.php index e0e7978c3..95af6415e 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -113,21 +113,18 @@ class NewgroupAction extends Action function trySave() { - $nickname = $this->trimmed('nickname'); + try { + $nickname = Nickname::normalize($this->trimmed('nickname')); + } catch (NicknameException $e) { + $this->showForm($e->getMessage()); + } $fullname = $this->trimmed('fullname'); $homepage = $this->trimmed('homepage'); $description = $this->trimmed('description'); $location = $this->trimmed('location'); $aliasstring = $this->trimmed('aliases'); - if (!Validate::string($nickname, array('min_length' => 1, - 'max_length' => 64, - 'format' => NICKNAME_FMT))) { - // TRANS: Group create form validation error. - $this->showForm(_('Nickname must have only lowercase letters '. - 'and numbers and no spaces.')); - return; - } else if ($this->nicknameExists($nickname)) { + if ($this->nicknameExists($nickname)) { // TRANS: Group create form validation error. $this->showForm(_('Nickname already in use. Try another one.')); return; @@ -177,9 +174,7 @@ class NewgroupAction extends Action } foreach ($aliases as $alias) { - if (!Validate::string($alias, array('min_length' => 1, - 'max_length' => 64, - 'format' => NICKNAME_FMT))) { + if (!Nickname::isValid($alias)) { // TRANS: Group create form validation error. $this->showForm(sprintf(_('Invalid alias: "%s"'), $alias)); return; |