Here is another interesting link:

http://jakarta.apache.org/turbine/fulcrum/fulcrum-crypto/

Note there is md5 and sha1 algorithm. Sha1 is better it provides a 160-bit sum. ;-)

I am wondering if cocoon need to borrow this code from fulcrum. I guess a lot of people need it. A better option is to setup a new jakarta project: commons-crypto or commons-security. ;-)

I hope this helps.

Best Regards,

Antonio Gallardo.

Christoph Hermann wrote:

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]


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

Reply via email to