In configure we do not need to set_config()
[cascardo/ipsilon.git] / ipsilon / login / authpam.py
index f322e14..10b550e 100755 (executable)
@@ -20,7 +20,6 @@
 from ipsilon.login.common import LoginFormBase, LoginManagerBase
 from ipsilon.login.common import FACILITY
 from ipsilon.util.plugin import PluginObject
-import cherrypy
 import pam
 import subprocess
 
@@ -34,10 +33,10 @@ class Pam(LoginFormBase):
             ok = pam.authenticate(username, password)
 
         if ok:
-            cherrypy.log("User %s successfully authenticated." % username)
+            self.log("User %s successfully authenticated." % username)
             return username
 
-        cherrypy.log("User %s failed authentication." % username)
+        self.log("User %s failed authentication." % username)
         return None
 
     def POST(self, *args, **kwargs):
@@ -49,13 +48,13 @@ class Pam(LoginFormBase):
         if username and password:
             user = self._authenticate(username, password)
             if user:
-                return self.lm.auth_successful(user, 'password')
+                return self.lm.auth_successful(self.trans, user, 'password')
             else:
                 error = "Authentication failed"
-                cherrypy.log.error(error)
+                self.error(error)
         else:
             error = "Username or password is missing"
-            cherrypy.log.error("Error: " + error)
+            self.error("Error: " + error)
 
         context = self.create_tmpl_context(
             username=username,
@@ -146,8 +145,7 @@ class Installer(object):
 
         po.wipe_config_values(FACILITY)
         config = {'service name': opts['pam_service']}
-        po.set_config(config)
-        po.save_plugin_config(FACILITY)
+        po.save_plugin_config(FACILITY, config)
 
         # Update global config to add login plugin
         po = PluginObject()
@@ -159,8 +157,7 @@ class Installer(object):
             order = []
         order.append('pam')
         globalconf['order'] = ','.join(order)
-        po.set_config(globalconf)
-        po.save_plugin_config(FACILITY)
+        po.save_plugin_config(FACILITY, globalconf)
 
         # for selinux enabled platforms, ignore if it fails just report
         try: