danielchatfield / wordpress-raven-auth

A raven authentication plugin for WordPress
Artistic License 2.0
3 stars 2 forks source link

redirect method on RavenAuthClient is incorrect #7

Closed dhedey closed 7 years ago

dhedey commented 9 years ago

Hi - one more bug (I believe?)

I have blanked out the Login function on the plugin because it was causing problems, and fallen back to just using RavenAuthClient for my needs. However, this means I am using the base methods, which I believe was causing errors.

The code currently looks like:

    public function redirect() {
        if (is_null($this->redirect_to or empty($this->redirect_to))) {
            return;
        } else {
            $this->_redirect($this->redirect_to);
        }
    }

When $this->redirect_to is null, this results in a call to _redirect(null); which causes the page load to fail.

I believe the code should read:

    public function redirect() {
        if (is_null($this->redirect_to) or empty($this->redirect_to)) {
            return;
        } else {
            $this->_redirect($this->redirect_to);
        }
    }

This fixes the bug, however, the ?WLS-response is still on the URL. This is probably, although arguably it should redirect to whatever the current URL and get attributes are (minus WLS-response), but that might be too much work.

The relevant part of readme.md is as follows:

$redirect_to             /* Where to redirect to afterwards - if not set then it 
                            defaults to the current URL */

Thanks again for working on this!

Best, David