danielchatfield / wordpress-raven-auth

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

Attempting to make use of custom options on RavenAuthClient fails as RavenAuthPlugin uses default options #6

Open dhedey opened 9 years ago

dhedey commented 9 years ago

As far as I'm aware, there's no code to trigger a WLS-Response, in order to trigger the RavenAuthPlugin? So I added it into a template, as a RavenAuthClient explained in the readme I also wanted to allow alumni to use it, so my code looked like:

    $client = new RavenAuthClient('live');
    try {
        $client->authenticate(null, null, false, true);
    } catch (RavenAuthException $e) {
        wp_die($e->getMessage());
    }

However, before that's even run, it turns out RavenAuthPlugin runs the code (through the 'template_redirect' hook):

    public function loginUser() {
        $site_name = get_bloginfo();
        try {
            $this->authenticate($site_name);
        } catch (RavenAuthException $e) {
            wp_die($e->getMessage());
        }
    }

Which not only causes an error for alumni (as it default to $allow_alumni=false), it also kills the page.

I guess what I'm asking is consideration of two things: EITHER 1a - The readme to tell the person to fork it if anything other than the default settings is required. OR (preferably) 1b - The auth check should not kill the page. Depending on how the plugin code is actually supposed to work to the end user, perhaps this should be swallowed? Also, the settings for the authenticate call should probably be settings in the admin panel?

2 - There to be some way to 'trigger' a raven login without custom code if people did actually want it for auth... (or an explanation of how to access it if one exists)

Apologies if any of that doesn't make sense, my understanding of both wordpress and raven are rather sketchy. In particular, I didn't want to fork this and work on fixes in case there are particular reasons for the above that I'm missing.

danielchatfield commented 9 years ago

I'll add an option to the WordPress plugin to allow allumni.

I'm sorry if the readme is a bit confusing - the majority of the content on it is for describing the low level raven library rather than the WordPress plugin which only utilises a subset of the features supported by the library.

dhedey commented 9 years ago

Just wanted to say thanks for creating this, it's ace! :+1: