michaelryanmcneill / shibboleth

Shibboleth plugin for WordPress
https://wordpress.org/plugins/shibboleth/
21 stars 12 forks source link

Debug login from frontend #53

Closed Alhrath closed 5 years ago

Alhrath commented 6 years ago

Here is a general fix to take into account the situation where the login form is displayed outside the login page, for instance when a theme display a login form in a menu or as a widget.

michaelryanmcneill commented 5 years ago

I would like to get @jrchamp's thoughts on this before approving this PR.

jrchamp commented 5 years ago

I've done some testing on a single site and it's definitely a better experience to have a working login link with an appropriate return_to. However, because $wp->request is null on the normal login page, the experience was worse. I found this to be better (overriding the URL only when it was available):

    global $wp;
    $url = false;
    if ( isset( $wp->request ) ) {
        $url = wp_login_url( home_url( $wp->request ) );
    }
    $login_url = add_query_arg( 'action', 'shibboleth', $url );

I'll take a look at the experience on multisite and follow up. EDIT: Working as expected. Not sure what else to test.

Alhrath commented 5 years ago

Ok like this ?

jrchamp commented 5 years ago

Yes, mostly. There shouldn't be any spaces used to indent, because WordPress uses tabs to indent.

Sorry, I know my comment uses spaces because the github comment box doesn't make adding tabs easy.

michaelryanmcneill commented 5 years ago

This looks good to me. Merging.