Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#1010240 by merlinofchaos, voxpelli: Redirect user back to page where…

… he logged in
  • Loading branch information...
commit 23bf6c686e1fa2b483db1758575028a365f769d2 1 parent 610b750
@voxpelli authored
Showing with 23 additions and 0 deletions.
  1. +23 −0 oauthconnector.module
View
23 oauthconnector.module
@@ -145,6 +145,11 @@ function oauthconnector_oauth_common_authorized($consumer_token, $access_token,
if (empty($info['real name'])) {
_connector_information_update($user->uid, array('real name' => TRUE));
}
+ if (!empty($_SESSION['oauthconnector_destination'])) {
+ $_REQUEST['destination'] = $_SESSION['oauthconnector_destination'];
+ unset($_SESSION['oauthconnector_destination']);
+ drupal_goto();
+ }
}
}
else {
@@ -356,6 +361,24 @@ function _oauthconnector_button($form, &$form_state) {
'callback' => $callback_url,
));
+ if (isset($_REQUEST['destination'])) {
+ $destination = $_REQUEST['destination'];
+ unset($_REQUEST['destination']);
+ }
+ elseif (isset($_REQUEST['edit']['destination'])) {
+ $destination = $_REQUEST['edit']['destination'];
+ unset($_REQUEST['edit']['destination']);
+ }
+ else {
+ $destination = isset($_GET['q']) ? $_GET['q'] : '';
+ $query = drupal_query_string_encode($_GET, array('q'));
+ if ($query != '') {
+ $destination .= '?'. $query;
+ }
+ }
+
+ $_SESSION['oauthconnector_destination'] = $destination;
+
drupal_goto($auth_url);
}
Please sign in to comment.
Something went wrong with that request. Please try again.