#52 Don't assume that an enabled login plugin is available
Closed 5 years ago by puiterwijk. Opened 5 years ago by rcritten.
rcritten/ipsilon safelogin  into  master

file modified
+1 -1
@@ -342,7 +342,7 @@ 

          plugins = self._site[FACILITY]

          if plugins.enabled:

              first = plugins.enabled[0]

-             plugin = plugins.available[first]

+             plugin = plugins.available.get(first)

          return plugin


      def root(self, *args, **kwargs):

no initial comment

if a plugin is enabled it should definitely be available, in what case this fails ?

I had an older install when we were still using mod_auth_kerb and the login plugin was named krb. I upgraded and krb was still enabled but there was no login plugin name krb so it blew up. This type of thing should be rare and otherwise handled during an upgrade but I'm just tightening up the code a bit.

Ok but won't thi end up returning a None, instead of the first available plugin ?

Sounds to me like the fix retquires to find the first available plugin and remove any bad entry from the enabled list ?

If it returns None then the root page will fallback to displaying the Login page which is fine IMHO. My goal was only to make it not crash since this is an unlikely scenario.

This has been merged, thanks.