pam: use a pam object method instead of pam module function
[cascardo/ipsilon.git] / ipsilon / providers / openid / auth.py
index 64245f5..561cd5a 100644 (file)
@@ -17,8 +17,8 @@ import json
 
 class AuthenticateRequest(ProviderPageBase):
 
-    def __init__(self, *args, **kwargs):
-        super(AuthenticateRequest, self).__init__(*args, **kwargs)
+    def __init__(self, site, provider, *args, **kwargs):
+        super(AuthenticateRequest, self).__init__(site, provider)
         self.stage = 'init'
         self.trans = None
 
@@ -26,7 +26,8 @@ class AuthenticateRequest(ProviderPageBase):
         try:
             # generate a new id or get current one
             self.trans = Transaction('openid', **kwargs)
-            if self.trans.cookie.value != self.trans.provider:
+            if (self.trans.cookie and
+                    self.trans.cookie.value != self.trans.provider):
                 self.debug('Invalid transaction, %s != %s' % (
                            self.trans.cookie.value, self.trans.provider))
         except Exception, e:  # pylint: disable=broad-except