我已将 Web2py 设置为在注册时发送电子邮件验证,并且在使用以下设置验证之前不允许登录:
mail=auth.settings.mailer
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'my_email_address@gmail.com'
mail.settings.tls=True
mail.settings.login = 'my_email_address@gmail.com:my_gmail_password'
auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = False
auth.settings.login_after_registration = False
正在发送电子邮件以重置密码,但不用于注册。它也允许登录。
我不知道为什么?
这是我的注册表单代码:
def register():
form = SQLFORM(db.auth_user)
form.element('table').insert(-1,(T('Please confirm that you are not a machine :'),Recaptcha(request, PUBLIC_KEY, PRIVATE_KEY, options="theme:'white'"),''))
if form.process(onvalidation=lola).accepted:
session.flash = 'record inserted'
make_thumb(db.auth_user, form.vars.id,(250,250))
redirect(URL('login'))
return dict(form=form)