replaced code duplicate
authorft
Thu, 15 May 2014 08:39:59 +0200
changeset 32628132055d9
parent 2 e0ab41bae977
child 4 da49f2de14ae
replaced code duplicate
src/passwordreceiver.py
     1.1 --- a/src/passwordreceiver.py	Tue Apr 08 14:32:40 2014 +0200
     1.2 +++ b/src/passwordreceiver.py	Thu May 15 08:39:59 2014 +0200
     1.3 @@ -29,32 +29,7 @@
     1.4      
     1.5      
     1.6      def GET(self, settings):
     1.7 -        
     1.8 -        # pick the arguments
     1.9 -        args = web.input()
    1.10 -                      
    1.11 -        if not "password" in args:
    1.12 -            raise web.badrequest()
    1.13 -
    1.14 -        if "keyfile" in args:
    1.15 -            keyfile = open (settings["keyfilepath"], "wr+")
    1.16 -            keyfile.write(args["keyfile"])
    1.17 -            keyfile.close()
    1.18 -            command = [settings["script"], settings["device"], settings["mountpoint"], args["password"], settings["keyfilepath"]]
    1.19 -        else:
    1.20 -            command = [settings["script"], settings["device"], settings["mountpoint"], args["password"]]
    1.21 -        
    1.22 -        process = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
    1.23 -        retval = process.wait()
    1.24 -        ( stdout, stderr ) = process.communicate()
    1.25 -        
    1.26 -        if "keyfile" in args:
    1.27 -            self.deleteKeyfile(settings["keyfilepath"])
    1.28 -            
    1.29 -        if (retval != 0):
    1.30 -            raise web.badrequest(stderr)
    1.31 -        
    1.32 -        return "Success: Encrypted Stick is mounted"
    1.33 +        self.POST()
    1.34      
    1.35      def POST(self, settings):
    1.36