Replace a couple plugin usages of NICKNAME_FMT with Nickname::normalize()

This commit is contained in:
Brion Vibber 2010-11-29 15:11:07 -08:00
parent 82799f675f
commit 8d3577da34
1 changed files with 5 additions and 16 deletions

View File

@ -324,12 +324,10 @@ class FacebookfinishloginAction extends Action
} }
} }
$nickname = $this->trimmed('newname'); try {
$nickname = Nickname::normalize($this->trimmed('newname'));
if (!Validate::string($nickname, array('min_length' => 1, } catch (NicknameException $e) {
'max_length' => 64, $this->showForm($e->getMessage());
'format' => NICKNAME_FMT))) {
$this->showForm(_m('Nickname must have only lowercase letters and numbers and no spaces.'));
return; return;
} }
@ -639,16 +637,7 @@ class FacebookfinishloginAction extends Action
*/ */
function isNewNickname($str) function isNewNickname($str)
{ {
if ( if (!Nickname::isValid($str)) {
!Validate::string(
$str,
array(
'min_length' => 1,
'max_length' => 64,
'format' => NICKNAME_FMT
)
)
) {
return false; return false;
} }