[FIX] auth_oauth: prevent crash on login screen
authorRichard Mathot <rim@openerp.com>
Wed, 2 Jul 2014 11:56:11 +0000 (13:56 +0200)
committerRichard Mathot <rim@openerp.com>
Wed, 2 Jul 2014 11:56:11 +0000 (13:56 +0200)
Empty URLs for OAuth providers do not crash anymore the login screen

addons/auth_oauth/controllers/main.py

index 214fdef..fe3c8be 100644 (file)
@@ -48,7 +48,8 @@ class OAuthLogin(openerp.addons.web.controllers.main.Home):
     def list_providers(self):
         try:
             provider_obj = request.registry.get('auth.oauth.provider')
-            providers = provider_obj.search_read(request.cr, SUPERUSER_ID, [('enabled', '=', True)])
+            providers = provider_obj.search_read(request.cr, SUPERUSER_ID, [('enabled', '=', True), ('auth_endpoint', '!=', False), ('validation_endpoint', '!=', False)])
+            # TODO in forwardport: remove conditions on 'auth_endpoint' and 'validation_endpoint' when these fields will be 'required' in model
         except Exception:
             providers = []
         for provider in providers: