cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Dalquist" <ebdal...@mtu.edu>
Subject Form Validator
Date Sat, 29 Jun 2002 16:06:29 GMT
I've been trying to get the form validator and DB Validator working for
about a week now. I decided to try and just got the form stuff working first
but I can't even get that. I'm running Cocoon 2.0.2-dev and Tomcat 4.1.3.

In my sitemap.xmap I have the following:

<!--
 | The page do_login does not actually exist this is just a dummy
 | target for the login auth to take place at.
 -->
<map:match pattern="do_login.xsp">
    <map:act type="form-validator">
        <map:parameter name="descriptor"
value="context://house_bills/descriptors/params.xml"/>
        <map:parameter name="validate-set" value="user-pass"/>

        <map:redirect-to uri="index.xsp"/>
    </map:act>

    <map:redirect-to uri="login.xsp"/>
</map:match>

login.xsp has a form that posts to do_login.xsp and has two inputs named
user_name and user_password.

Here is my params.xml
<?xml version="1.0"?>
<root>
  <parameter name="user_name" type="string" nullable="no"/>
  <parameter name="user_password" type="string" nullable="no"/>

  <constraint-set name="name-pass">
    <validate name="user_name"/>
    <validate name="user_password"/>
  </constraint-set>
</root>

I've checked through the logs and there aren't any context errors so Cocoon
seems to be finding the params.xml file OK. Everytime I submit the form I
get bounced back to the login.xsp page instead of getting sent to index.xsp.
It doesn't matter if I don't put anything in the inputs or have valid data
in both.

I would also like to be able to validate the user_name & password_fields
against a MySQL database and setting the value in the corresponding user_id
column in a session variable. I played with it a little and cocoon was
connection to the DB but not authenticating, I don't have my descriptor file
for that any more. Here is my DDL for the table I want to auth against.

CREATE TABLE `users` (
  `user_id` int(11) unsigned NOT NULL auto_increment,
  `user_name` varchar(255) NOT NULL default '',
  `user_password` varchar(16) NOT NULL default '',
  `user_first_name` varchar(255) NOT NULL default '',
  `user_last_name` varchar(255) NOT NULL default '',
  `user_email` varchar(255) NOT NULL default '',
  `user_status` tinyint(4) unsigned NOT NULL default '1',
  PRIMARY KEY  (`user_id`),
  UNIQUE KEY `user_login` (`user_name`,`user_password`),
  UNIQUE KEY `user_id` (`user_id`)
) TYPE=MyISAM

My other question with the DBAuth stuff is can cocoon run the submitted
password through MySQLs PASSWORD() function? I would really like to be able
to keep the password column in the table encrypted and still be able to use
the DBAuth stuff.

I hope someone can give me a hand with this. After a week of searching the
mailing lists, coocon site and web in general I'm stuck!

-Eric Dalquist



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message