Jump to content

Topic on Extension talk:GoogleAppsAuthentification

Redirecting to login page after login

4
208.97.104.194 (talkcontribs)

I was having an issue where after logging in from the home page, mediawiki would bring you straight back to the login page with a username and password field.

So I modified this code:

       // Return URL
       $config['return_server'] = (isset($_SERVER["HTTPS"]) ? 'https://' : 'http://') .$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT'];
       $config['return_url'] = $config['return_server'].$_SERVER['REQUEST_URI'];

to

       // Return URL
       $config['return_server'] = (isset($_SERVER["HTTPS"]) ? 'https://' : 'http://') .$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT'];
       if ($_REQUEST["title"] == $lg->specialPage("Userlogin")) {
               $config['return_url'] = $config['return_server'].$_SERVER['SCRIPT_NAME'];
       }
       else {
               $config['return_url'] = $config['return_server'].$_SERVER['REQUEST_URI'];
       }

This resolved my issue.

5.28.71.149 (talkcontribs)

Thanks! Had the same issue. (MW1.19.1) However you missed one simple line.

Before the code above add: $lg = Language::factory($wgLanguageCode);

Otherwise you get a blank page. (Or PHP-Error of unknown $lg, depending on your debug settings.)

Additionaly, after Login I get a dialog asking if I wanted to purge the cache of the mainpage. (Usually only NOT logged in users should get that.) Fixed it by changing:

$wgOut->redirect($url."?action=purge");

to

$wgOut->redirect($url."?action=view");

Have to wait and see if there are serious isuess with with not-current mainpages.

Dyspatch (talkcontribs)

I am still working through some issues here, but two modifications are already apparent to the above.

  1. You need to also specify the global variable, $wgLanguageCode, at the top of the getGoogleAccount function.
  2. The "?action=view" is not the proper query string syntax. It needs to be an "&" instead of a "?".

That all being said, I am noticing issues with this implementation when it comes to logging in from pages that aren't the main page. I'll update this once I've worked through those issues.

45.116.117.148 (talkcontribs)

when i open my wiki URL then by default it shows Main page Not shows Login page how to do this

Means When i open URL The login page should open first not Main page

Reply to "Redirecting to login page after login"