]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profileformaction.php
For good measure, don't return autocomplete results when not logged in.
[quix0rs-gnu-social.git] / lib / profileformaction.php
index 0ffafe5fb8d1279aeea4828b4da54c38869dae7a..51c89a922ea9b57ac7ae73952b546b2c21a59b18 100644 (file)
@@ -60,7 +60,16 @@ class ProfileFormAction extends RedirectingAction
         $this->checkSessionToken();
 
         if (!common_logged_in()) {
-            $this->clientError(_('Not logged in.'));
+            if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+                $this->clientError(_('Not logged in.'));
+            } else {
+                // Redirect to login.
+                common_set_returnto($this->selfUrl());
+                $user = common_current_user();
+                if (Event::handle('RedirectToLogin', array($this, $user))) {
+                    common_redirect(common_local_url('login'), 303);
+                }
+            }
             return false;
         }
 
@@ -97,7 +106,7 @@ class ProfileFormAction extends RedirectingAction
 
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->handlePost();
-            $this->returnToArgs();
+            $this->returnToPrevious();
         }
     }