]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Replace a couple plugin usages of NICKNAME_FMT with Nickname::normalize()
authorBrion Vibber <brion@pobox.com>
Mon, 29 Nov 2010 23:11:07 +0000 (15:11 -0800)
committerBrion Vibber <brion@pobox.com>
Mon, 29 Nov 2010 23:11:07 +0000 (15:11 -0800)
plugins/FacebookBridge/actions/facebookfinishlogin.php

index 2174c5ad4a020fea2ba508885195791f1d073c93..349acd7e2298630e8839c13724c07ce907449e9f 100644 (file)
@@ -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;
         }