With the current Auth you cannot have two forms on the same page. I
will change it.

Massimo

On Apr 6, 6:25 am, Yannick <ytchatch...@gmail.com> wrote:
> Hello Massimo,
> Thanks for the note... Yes i know the processing is done on the
> "Tools.py", The reason why i put those in the controller is because i
> was trying so many things to make it work...
> So i commented it out, here is how my controller look like:
>
> ###############################################
> def logreg():
>     loginform =  auth.login(next="profile")
>     regform =  auth.register(next="login")
>     return dict(regform = regform, loginform = loginform)
> ###############################################
>
> It still doesn't work... Did you try it ? it is working on your side ?
>
> Thanks for your attention,
>
> Yannick P.
> On Apr 6, 12:57 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > I am very confused by this:
>
> >     loginform =  auth.login(next="profile")
> >     regform =  auth.register(next="login")
> >     if regform.accepts(request.vars, formname='register'): ## WRONG
> >         pass
> >     if loginform.accepts(request.vars,formname='login'):  ## WRONG
> >         pass
>
> > auth.login(...) INCLUDES form processing (accepts).
>
> > On Apr 5, 9:36 pm, Yannick <ytchatch...@gmail.com> wrote:
>
> > > Hello mate,
> > > For some reasons when using a custom form with two forms in the same
> > > view the validation is not properly done.  Here is an example with two
> > > forms (Login and Register) in the same view.
> > > The validation for the "Email" on the register form is not correct;
> > > the user is able to register several users with the same email even if
> > > this is set when the table is define
> > >                           (table.email.requires = [IS_EMAIL(),
> > > IS_NOT_IN_DB(db, '%s.email'
> > >                                  %
> > > self.settings.table_user._tablename)])...
>
> > > This problem occur ONLY when there are two forms on the same view...
> > > There is no problem on Email validation when we only have one form.
>
> > > Below is the sample of the controller and view:
>
> > > #Controller
> > > #######################################
> > > def logreg():
> > >     loginform =  auth.login(next="profile")
> > >     regform =  auth.register(next="login")
>
> > >     if regform.accepts(request.vars, formname='register'):
> > >         pass
>
> > >     if loginform.accepts(request.vars,formname='login'):
> > >         pass
> > >     return dict(regform = regform, loginform = loginform)
>
> > > #View
> > > #######################################
>
> > > # Register Form
> > > <form action="" enctype="multipart/form-data" method="post">
>
> > >  <input class="string" id="auth_user_first_name" name="first_name"
> > > type="text"     value=" {{=regform.latest.first_name}}" /></td>
>
> > >  <input class="string" id="auth_user_last_name" name="last_name"
> > > type="text" value="{{=regform.latest.last_name}}" />
>
> > >  <input class="string" id="auth_user_email" name="email" type="text"
> > > value="{{=regform.latest.email}}" />
>
> > >  <input name="password2" type="password"
> > > value="{{=regform.latest.password}}"/>
>
> > >  <input type="submit" value="Submit" />
>
> > > {{=regform.hidden_fields()}}
> > > </form>
>
> > > # Login Form
>
> > > <form action="" enctype="multipart/form-data" method="post">
> > >                <input class="string" id="auth_user_email" name="email"
> > > type="text" value="{{=loginform.latest.email}}" / >
> > >                <input class="password" id="auth_user_password"
> > > name="password" type="password" value="{{=loginform.latest.password}}"/
>
> > >                  <input type="submit" value="Submit" />
> > >              {{=loginform.hidden_fields()}}
> > > </form>
> > > #########################################
>
> > > Did anyone already had the same issue ?
>
> > > Thanks for your attention,
> > > Yannick P.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to