X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fregister.php;h=488d8901fc63db04178982076441e58c295e72ee;hb=c0bb1a57984266024e8e5a968c0f3a3b54befff6;hp=7307bc689b26cda56839fbadfb4ada3992bbe14d;hpb=6eae5d6a7e2265de4065b764c28cef3ee009bcda;p=quix0rs-gnu-social.git diff --git a/actions/register.php b/actions/register.php index 7307bc689b..488d8901fc 100644 --- a/actions/register.php +++ b/actions/register.php @@ -198,7 +198,11 @@ class RegisterAction extends Action } // Input scrubbing - $nickname = common_canonical_nickname($nickname); + try { + $nickname = Nickname::normalize($nickname); + } catch (NicknameException $e) { + $this->showForm($e->getMessage()); + } $email = common_canonical_email($email); if (!$this->boolean('license')) { @@ -206,11 +210,6 @@ class RegisterAction extends Action 'agree to the license.')); } else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) { $this->showForm(_('Not a valid email address.')); - } else if (!Validate::string($nickname, array('min_length' => 1, - 'max_length' => 64, - 'format' => NICKNAME_FMT))) { - $this->showForm(_('Nickname must have only lowercase letters '. - 'and numbers and no spaces.')); } else if ($this->nicknameExists($nickname)) { $this->showForm(_('Nickname already in use. Try another one.')); } else if (!User::allowed_nickname($nickname)) { @@ -224,14 +223,16 @@ class RegisterAction extends Action $this->showForm(_('Homepage is not a valid URL.')); return; } else if (!is_null($fullname) && mb_strlen($fullname) > 255) { - $this->showForm(_('Full name is too long (max 255 chars).')); + $this->showForm(_('Full name is too long (maximum 255 characters).')); return; } else if (Profile::bioTooLong($bio)) { - $this->showForm(sprintf(_('Bio is too long (max %d chars).'), + $this->showForm(sprintf(_m('Bio is too long (maximum %d character).', + 'Bio is too long (maximum %d characters).', + Profile::maxBio()), Profile::maxBio())); return; } else if (!is_null($location) && mb_strlen($location) > 255) { - $this->showForm(_('Location is too long (max 255 chars).')); + $this->showForm(_('Location is too long (maximum 255 characters).')); return; } else if (strlen($password) < 6) { $this->showForm(_('Password must be 6 or more characters.')); @@ -429,16 +430,15 @@ class RegisterAction extends Action if (Event::handle('StartRegistrationFormData', array($this))) { $this->elementStart('li'); $this->input('nickname', _('Nickname'), $this->trimmed('nickname'), - _('1-64 lowercase letters or numbers, '. - 'no punctuation or spaces. Required.')); + _('1-64 lowercase letters or numbers, no punctuation or spaces.')); $this->elementEnd('li'); $this->elementStart('li'); $this->password('password', _('Password'), - _('6 or more characters. Required.')); + _('6 or more characters.')); $this->elementEnd('li'); $this->elementStart('li'); $this->password('confirm', _('Confirm'), - _('Same as password above. Required.')); + _('Same as password above.')); $this->elementEnd('li'); $this->elementStart('li'); if ($this->invite && $this->invite->address_type == 'email') { @@ -465,7 +465,12 @@ class RegisterAction extends Action $this->elementStart('li'); $maxBio = Profile::maxBio(); if ($maxBio > 0) { - $bioInstr = sprintf(_('Describe yourself and your interests in %d chars'), + // TRANS: Tooltip for field label in form for profile settings. Plural + // TRANS: is decided by the number of characters available for the + // TRANS: biography (%d). + $bioInstr = sprintf(_m('Describe yourself and your interests in %d character', + 'Describe yourself and your interests in %d characters', + $maxBio), $maxBio); } else { $bioInstr = _('Describe yourself and your interests');