Hi Massimo,
I upgraded my web2py to the latest version and applied your code, the
Recaptcha still
does not show. Here is the page source.
-------------------------------------------------
<h2>Alumni Log-In</h2>
<br>
<p>Note: Please register first before log-in. To display a new two
letter </p>
<p>&nbsp &nbsp &nbsp &nbsp &nbsp word, click 'Get a new challenge'
button in Recaptcha box.</p>

<br>
<form action="" enctype="multipart/form-data" method="post"><table><tr
id="auth_user_email__row"><td><label for="auth_user_email"
id="auth_user_email__label">Email Address: </label></td>
<td><input class="email" id="auth_user_email" name="email" type="text"
value="" /></td>td>/td></tr>
<tr id="auth_user_password__row">
<td><label for="auth_user_password"
id="auth_user_password__label">Password: </label></td>
<td><input class="password" id="auth_user_password" name="password"
type="password" value="" ></td>
<td></td></tr>
<tr id="submit_record__row">
<td></td>
<td><input type="submit" value="Submit" /><input
onclick="window.location='/alumni/default/index';" type="button"
value="Cancel" /></td>
<td></td></tr>
</table><div class="hidden"><input name="_next" type="hidden" /><input
name="_formkey" type="hidden"
value="6cef9bcb-5093-40ff-8526-2dd6de807b4b" /><input name="_formname"
type="hidden" value="login" /></div></form>
<img src="/alumni/static/images/space.gif" width=20 height=200 /></
td>
<div class="flash"></div><br><br></tr>
<tr><td colspan="10" class="footer">
<p>Copyright &copy; 2009 - Powered by <a href="http://
www.web2py.com">web2py</a></p></td>
</tr></table></div></body></html>
--------------------------------------------
Thank you again.
Ed


On Dec 4, 2:24 pm, mdipierro <[email protected]> wrote:
> I am puzzled. Does it show or does it not show. What do you see in the
> page source?
>
> On Dec 4, 12:17 am, ed <[email protected]> wrote:
>
> > Hi Massimo,
> > I now understand that it's a special case. I copied your code and
> > restarted the server, but still " auth.settings.login_captcha "
> > doesn't work.
> > Ed
>
> > On Dec 4, 1:19 pm, mdipierro <[email protected]> wrote:
>
> > > Now I understand better. It does not work because the recaptcha has to
> > > be inserted in a form=SQLFORM.... after it is defined but before it is
> > > acceted. Since you are using form=auth.login() this function creates
> > > the form and accepts in one step. It cannot be done without modifying
> > > gluon tools. I have done it, so please try:
>
> > > def login():
> > >     from gluon.tools import Recaptcha
> > >     auth.settings.login_catpcha = Recaptcha
> > > (request,public_key,private_key)
> > >     form = auth.login()
> > >     form[0][-1][1].append(INPUT(_type='button',
> > >         _value='Cancel',_onclick="window.location='%s';"\
> > >         % URL(r=request,f='index')))
> > >     return dict(form=form)
>
> > > On Dec 3, 8:53 pm, ed <[email protected]> wrote:
>
> > > > Hi Massimo,
> > > > The code does not display the recaptcha. Inserted code that displayed
> > > > recaptcha but still failed to validate recaptcha words. I am baffled
> > > > why the code works perfectly with the Registration and it doesn't with
> > > > Login. Thanks again.
> > > > Ed
>
> > > > On Dec 3, 12:45 pm, mdipierro <[email protected]> wrote:
>
> > > > > Does it work if you do it this way?
>
> > > > > deflogin():
> > > > >     from gluon.tools importRecaptcha
> > > > >     auth.settings.catpcha =Recaptcha(request,public_key,private_key)
> > > > >     form = auth.login()
> > > > >     form[0][-1][1].append(INPUT(_type='button',
> > > > >         _value='Cancel',_onclick="window.location='%s';"\
> > > > >         % URL(r=request,f='index')))
> > > > >     return dict(form=form)
>
> > > > > Massimo
>
> > > > > On Dec 2, 9:46 pm, ed <[email protected]> wrote:
>
> > > > > > Hi,
> > > > > > I implementedRecaptchain my Registration app and works very well.
> > > > > > But when I implemented the same inLoginit does not check the "two
> > > > > > words" which Recaptch requires. The following is the code:
> > > > > > ----------------------------------
> > > > > > -- Models --
> > > > > >     db.py
> > > > > > auth.define_tables()
> > > > > > auth.settings.login='email:password'
> > > > > > from gluon.tools importRecaptcha
> > > > > > auth.settings.captcha =Recaptcha(request, '6LcUfwkAAAAAACt0m',
> > > > > > '6LcUfwkAAAAAAcUWLVn')
>
> > > > > > -- Controllers --
> > > > > >    default.py
> > > > > > public_key = '6LcUfwkAAAAAACt0m'
> > > > > > private_key = '6LcUfwkAAAAAAPcUWLVn'
>
> > > > > > def user():
> > > > > >     if request.args(0)=='reg_col':
> > > > > >         from gluon.tools importRecaptcha
> > > > > >         match_it = IS_EXPR('value==%s' % 
> > > > > > repr(request.vars.password),
> > > > > > error_message='passwords do not match')
> > > > > >         form = SQLFORM.factory(
> > > > > >         Field('emailad', 'emailad',requires=[IS_LENGTH
> > > > > > (maxsize=30,error_message='Maximum length 30 chars..'),IS_EMAIL(),
> > > > > > IS_NOT_IN_DB(db,'auth_user.email',error_message='Email address 
> > > > > > already
> > > > > > exist.')], required=True, label='* Email Address'),
> > > > > >         Field('name', 'first',requires=[IS_LENGTH
> > > > > > (minsize=2,maxsize=30,error_message='Minimum length 2 and maximum
> > > > > > 30.'),IS_UPPER()], label='* Name'),
> > > > > >         Field('degree', 'degree',required=False,requires=IS_IN_DB
> > > > > > (db,'degreecurric.curcode','%(curcode)s'),label='* Degree Earned'),
> > > > > >         Field('batchyr', 'batchyr', required=False,requires=IS_IN_DB
> > > > > > (db,'batchyr.moyear','%(moyear)s'),label='* Batch Year'),
> > > > > >         Field('password', 'password',label='* Password', requires=
> > > > > > [IS_LENGTH(minsize=6,maxsize=30,error_message='Minimum length 6 and
> > > > > > maximum 30.')]),
> > > > > >         Field('password_verify', 'password',label='* Password 
> > > > > > verify',
> > > > > > requires=match_it))
> > > > > >         form[0].insert(-1, TR('',  Recaptcha
> > > > > > (request,public_key,private_key)))        [-1][1].append(INPUT
> > > > > > (_type='button',_value='Cancel',_onclick="window.location='%s';"%URL
> > > > > > (r=request,f='index')))
> > > > > >         if form.accepts(request.vars, session):
> > > > > >             emil = request.vars.emailad
> > > > > >             name = request.vars.name
> > > > > >             pasword = request.vars.password
> > > > > >             password_verify = request.vars.password_verify
> > > > > >           return dict(form=form)
>
> > > > > > deflogin():
> > > > > >     from gluon.tools importRecaptcha
> > > > > >     form = auth.login()
> > > > > >     form[0].insert(-1, TR('',  Recaptcha
> > > > > > (request,public_key,private_key)))
> > > > > >     form[0][-1][1].append(INPUT
> > > > > > (_type='button',_value='Cancel',_onclick="window.location='%s';"%URL
> > > > > > (r=request,f='index')))
> > > > > >     return dict(form=form)
>
> > > > > > --- Views --
> > > > > >     user.html
> > > > > > {{if request.args(0)=='reg_col':}}
> > > > > > <h2>College Alumni Registration</h2>
> > > > > > <br>
> > > > > > {{=form}}
> > > > > > {{pass}}
>
> > > > > >   -login.html -
> > > > > >  <h2>Alumni Log-In</h2>
> > > > > > <br>
> > > > > > {{=form}}
> > > > > > {{pass}}
> > > > > > -----------------------------------------------------------------
> > > > > > I've reviewed the source code and tested various solutions but 
> > > > > > failed
> > > > > > to see what's wrong with it. Did I miss something?
> > > > > > Thanks a lot in advance.
> > > > > > Ed
>
>

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to