multidimension-al / phpbbauth

A Mediawiki extension for phpBB authentication using Auth_remoteuser.
MIT License
5 stars 5 forks source link

Redirection after login from a page with special characters truncates page name #6

Closed phbaudin closed 5 years ago

phbaudin commented 5 years ago

If a user logs in from a page on the wiki with special characters in the title, phpBB will redirect him to the original link, only truncated from the first special character.

A simple urlencode in Phpbbauth/PhpbbAuthHooks.php seems to solve the issue:

Replaced:

            $personal_urls['login']['href'] = $wgPhpBBAuthForumDirectory . 'ucp.php?mode=login&redirect=' . $_SERVER[ 'REQUEST_URI' ];

with:

            $personal_urls['login']['href'] = $wgPhpBBAuthForumDirectory . 'ucp.php?mode=login&redirect=' . urlencode( $_SERVER[ 'REQUEST_URI' ] );

Replaced:

            $personal_urls['anonlogin']['href'] = $wgPhpBBAuthForumDirectory . 'ucp.php?mode=login&redirect=' . $_SERVER[ 'REQUEST_URI' ];

with:

            $personal_urls['anonlogin']['href'] = $wgPhpBBAuthForumDirectory . 'ucp.php?mode=login&redirect=' . urlencode( $_SERVER[ 'REQUEST_URI' ] );
ajquick commented 5 years ago

Thank you. This seems to be an obvious and straight forward fix. Now if only there were any easy fix to override the phpBB code that prevents redirecting to a folder outside of phpBB!

ajquick commented 5 years ago

Fixed in version v0.0.6, including the addition of the $wgServer variable for absolute pathing. Useful for installations where the forum and wiki are on seperate domains or subdomains.

https://github.com/multidimension-al/phpbbauth/releases/tag/0.0.6