From: Evan Prodromou Date: Tue, 4 Aug 2009 17:10:37 +0000 (-0400) Subject: new action for when we redirect to login page X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8f122dd71efcc54b820629bc4c39efe91b8e8726;p=quix0rs-gnu-social.git new action for when we redirect to login page --- diff --git a/EVENTS.txt b/EVENTS.txt index ef4c2cffa4..25d95fe068 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -223,3 +223,7 @@ EndRegistrationTry: after saving a new user (note: no profile or user object!) StartNewQueueManager: before trying to start a new queue manager; good for plugins implementing new queue manager classes - $qm: empty queue manager to set + +RedirectToLogin: event when we force a redirect to login (like when going to a settings page on a remembered login) +- $action: action object being shown +- $user: current user diff --git a/lib/settingsaction.php b/lib/settingsaction.php index 17d3a2f64d..4cf9b80c4a 100644 --- a/lib/settingsaction.php +++ b/lib/settingsaction.php @@ -77,10 +77,12 @@ class SettingsAction extends CurrentUserDesignAction // _all_ our settings are important common_set_returnto($this->selfUrl()); $user = common_current_user(); - if ($user->hasOpenID()) { - common_redirect(common_local_url('openidlogin'), 303); - } else { - common_redirect(common_local_url('login'), 303); + if (Event::handle('RedirectToLogin', array($this, $user))) { + if ($user->hasOpenID()) { + common_redirect(common_local_url('openidlogin'), 303); + } else { + common_redirect(common_local_url('login'), 303); + } } } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->handlePost();