]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Registration coding cleanup
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 18 Jan 2015 12:06:12 +0000 (13:06 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 18 Jan 2015 12:06:12 +0000 (13:06 +0100)
Mainly there was an Undefined variable: code in apiaccountregister.php

actions/apiaccountregister.php
actions/register.php
classes/User.php

index 9926fc8cf933762c0fd476c94203214d086a0588..b5481df1cba369e239fb9564ab75c85711d359e8 100644 (file)
@@ -163,8 +163,8 @@ class ApiAccountRegisterAction extends ApiAction
                                                        'homepage' => $homepage,
                                                        'bio' => $bio,
                                                        'location' => $location,
-                                                       'code' => $code))) {
-                   if (!$user) {
+                                                       'code' => $this->code))) {
+                   if (!$user instanceof User) {
                        // TRANS: Form validation error displayed when trying to register with an invalid username or password.
                        $this->clientError(_('Invalid username or password.'), 400);
                    }
index 82fb9fc5736a97fa16c9be69bbdfb236e3303bee..c97201b666762b67611233e60544a0e134ad78a5 100644 (file)
@@ -64,7 +64,7 @@ class RegisterAction extends Action
      * @param $args
      * @return string title
      */
-    function prepare($args)
+    protected function prepare(array $args=array())
     {
         parent::prepare($args);
         $this->code = $this->trimmed('code');
@@ -83,7 +83,7 @@ class RegisterAction extends Action
 
         if (!empty($this->code)) {
             $this->invite = Invitation::getKV('code', $this->code);
-            if (empty($this->invite)) {
+            if (!$this->invite instanceof Invitation) {
             // TRANS: Client error displayed when trying to register to an invite-only site without a valid invitation.
                 $this->clientError(_('Sorry, invalid invitation code.'));
             }
index 1ccbdbc2174c20128845b19247040ff9d9030ab6..bed702867b6b2823922f55562aadaebba99c4537 100644 (file)
@@ -276,7 +276,7 @@ class User extends Managed_DataObject
 
         if (!empty($code)) {
             $invite = Invitation::getKV($code);
-            if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
+            if ($invite instanceof Invitation && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
                 $user->email = $invite->address;
             }
         }