salvamomo / drupalauth

Automatically exported from code.google.com/p/drupalauth
0 stars 0 forks source link

Cannot pass language from SP (fix included) #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
It is not possible to provide a language parameter from SP to IdP, because 
drupalauth module will always redirect user to /user path of the IdP Drupal.

What is the expected output? What do you see instead?
Login is always in default language. It would be nice to have it in the same 
language as in SP when user starts the login process.

What version of the product are you using? On what operating system?
Latest code on Drupal 7.30.

Please provide any additional information below.
Below is a fix for both simplesamlphp and drupal modules. A language url 
parameter can be passed from SP to IdP and it will be stored in session. IdP 
Drupal needs to have the language negotiation set to session with "language" as 
parameter name.

Add this to drupalauth4ssp.module

/**
 * Implements hook_init().
 */
function drupalauth4ssp_init() {
  // Store language to session from URL if set
  if (isset($_GET['language'])) {
    $_SESSION['language'] = $_GET['language'];
  }
  // Store destination to session from URL if set
  if (isset($_GET['destination'])) {
    $_SESSION['destination'] = $_GET['destination'];
  }
}

And this to External.php:

  // If language is set, then append it to URL so that Drupal can react
  if (isset($_GET['language'])) {
    $authPage = $authPage . '&language=' . $_GET['language'];
  }

Original issue reported on code.google.com by joonas.m...@wunderkraut.com on 21 Aug 2014 at 12:32