Aurelien DEHAY schrieb:

Hello,

> I'm a really great beginner with the binding framework. My question is
> very simple: I've got a password field I'd like to md5() before putting
> it in my exist database.

I do that in flow:

        form = new Form("cforms/definition/editUser_def.xml");
        form.createBinding(bindingURI);
        
        form.load(document);
        
        var oldhash = form.lookupWidget("pass").getValue();
        print ("oldhash: " + oldhash);
        // prevent password value from leaving server
        form.lookupWidget("pass").setValue(null);
        
        // display form
        form.showForm("editUser-display-pipeline");
        
        // hash pass if entered
        if (form.lookupWidget("pass").getValue() != null) {
                //hash password
                print("hashing...");
                var hash =
Packages.de.iif.chermann.crypt.MD5.md5(form.lookupWidget("pass").getValue());
                form.lookupWidget("pass").setValue(hash);
        } else {
                print("pass not given, setting original hash");
                form.lookupWidget("pass").setValue(oldhash);
        }
        form.save(document);
        //save bean back to eXist xml db
        saveDocumentAuth(document, docName, docBaseURI, "user", "pass", "true");

HTH
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to