diff options
author | Brion Vibber <brion@pobox.com> | 2010-11-29 15:11:07 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-11-29 15:11:07 -0800 |
commit | 8d3577da349a5c6e497d8ff57a367e04eb5084a8 (patch) | |
tree | 1859dc3ee7018d662d833ec508b85846477647d5 /plugins | |
parent | 82799f675f2afa067ecb46e829d9b93b79b773b2 (diff) |
Replace a couple plugin usages of NICKNAME_FMT with Nickname::normalize()
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/FacebookBridge/actions/facebookfinishlogin.php | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/plugins/FacebookBridge/actions/facebookfinishlogin.php b/plugins/FacebookBridge/actions/facebookfinishlogin.php index 2174c5ad4..349acd7e2 100644 --- a/plugins/FacebookBridge/actions/facebookfinishlogin.php +++ b/plugins/FacebookBridge/actions/facebookfinishlogin.php @@ -324,12 +324,10 @@ class FacebookfinishloginAction extends Action } } - $nickname = $this->trimmed('newname'); - - if (!Validate::string($nickname, array('min_length' => 1, - 'max_length' => 64, - 'format' => NICKNAME_FMT))) { - $this->showForm(_m('Nickname must have only lowercase letters and numbers and no spaces.')); + try { + $nickname = Nickname::normalize($this->trimmed('newname')); + } catch (NicknameException $e) { + $this->showForm($e->getMessage()); return; } @@ -639,16 +637,7 @@ class FacebookfinishloginAction extends Action */ function isNewNickname($str) { - if ( - !Validate::string( - $str, - array( - 'min_length' => 1, - 'max_length' => 64, - 'format' => NICKNAME_FMT - ) - ) - ) { + if (!Nickname::isValid($str)) { return false; } |