new action for when we redirect to login page

This commit is contained in:
Evan Prodromou 2009-08-04 13:10:37 -04:00
parent 9421b36498
commit 8f122dd71e
2 changed files with 10 additions and 4 deletions

View File

@ -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 StartNewQueueManager: before trying to start a new queue manager; good for plugins implementing new queue manager classes
- $qm: empty queue manager to set - $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

View File

@ -77,10 +77,12 @@ class SettingsAction extends CurrentUserDesignAction
// _all_ our settings are important // _all_ our settings are important
common_set_returnto($this->selfUrl()); common_set_returnto($this->selfUrl());
$user = common_current_user(); $user = common_current_user();
if ($user->hasOpenID()) { if (Event::handle('RedirectToLogin', array($this, $user))) {
common_redirect(common_local_url('openidlogin'), 303); if ($user->hasOpenID()) {
} else { common_redirect(common_local_url('openidlogin'), 303);
common_redirect(common_local_url('login'), 303); } else {
common_redirect(common_local_url('login'), 303);
}
} }
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') { } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->handlePost(); $this->handlePost();