dokuwiki-plugin-oauth icon indicating copy to clipboard operation
dokuwiki-plugin-oauth copied to clipboard

No "log in" button when singleService is set

Open farfalleflickan opened this issue 1 year ago • 2 comments

Issue Description

When singleService is off, I get the standard login page. If singleService is on, the link/button to log in is broken/missing, displaying "Log Out" even though I am not logged in. If I manually go to doku.php?id=start&do=login&sectok= I get redirected and can login. See attached screenshots. I'm not sure if it's a bug or if I have misconfigured something, looking at the logs I see no warnings or errors and looking at the documentation I don't think I have missed anything.

singleService off: singleService_off

singleService on (not logged in): singleService_on

farfalleflickan avatar Jul 05 '24 23:07 farfalleflickan

I did some digging, it is because REMOTE_USER is still set even though we logged out. I crudely hacked in a $_SERVER['REMOTE_USER'] = null; in inc/Menu/Item/Login.php and it works as intended (although whilst fucking up shit, ofc).

I would assume one ought to do it like in auth_logoff, but I haven't managed to make it work...

farfalleflickan avatar Aug 06 '24 22:08 farfalleflickan

I've had the same issue, after a bit of digging it appears the issue is that REMOTE_USER is coming empty from the web server/php and typically auth_logoff, triggered from auth_login, removes this variable if it is empty. However, if singleService is active trustExternal from this plugin doesn't trigger the normal login flow. I fixed it for me by adding $INPUT->server->remove("REMOTE_USER"); in trustExternal before the try-block, which shouldn't have any negative effects.

A solution for inclusion in this repo should probably be somewhat cleaner

adnidor avatar Jan 29 '25 20:01 adnidor