Here's my registration form:
db.define_table(
auth.settings.table_user_name,
Field <http://127.0.0.1:8000/examples/global/vars/Field>('email',
length=128, default=''),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('password',
'password', length=512, readable=False),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('password_verify',
'password', length=512, readable=False),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('registration_time',
'datetime', requires=IS_DATETIME
<http://127.0.0.1:8000/examples/global/vars/IS_DATETIME>(), writable=False,
readable=False, default=request
<http://127.0.0.1:8000/examples/global/vars/request>.utcnow),
Field
<http://127.0.0.1:8000/examples/global/vars/Field>('registration_key',
length=512, writable=False, readable=False, default=''),
Field <http://127.0.0.1:8000/examples/global/vars/Field>('registration_id',
length=512, writable=False, readable=False, default='')
)
custom_auth_table = db[auth.settings.table_user_name] #get the custom_auth_table
custom_auth_table.email.requires = [
IS_NOT_EMPTY
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>(error_message='Please
input an email address'),
IS_EMAIL
<http://127.0.0.1:8000/examples/global/vars/IS_EMAIL>(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_IN_DB>(db,
custom_auth_table.email)]
custom_auth_table.password.requires = [
IS_NOT_EMPTY
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>(error_message='Please
type a password'),
IS_STRONG <http://127.0.0.1:8000/examples/global/vars/IS_STRONG>(min=8,
special=0, upper=1),
CRYPT <http://127.0.0.1:8000/examples/global/vars/CRYPT>()]
custom_auth_table.password_verify.requires = [
IS_NOT_EMPTY
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>(error_message='Please
retype your password'),
IS_EQUAL_TO
<http://127.0.0.1:8000/examples/global/vars/IS_EQUAL_TO>(request
<http://127.0.0.1:8000/examples/global/vars/request>.vars.password,
error_message='Passwords do not match'),
CRYPT <http://127.0.0.1:8000/examples/global/vars/CRYPT>()]
auth.settings.table_user = custom_auth_table # tell auth to use
custom_auth_table
## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)
auth.settings.registration_requires_verification = True
#To automatically login people after registration, even if they have not
completed the email verification process, set the following to True
auth.settings.login_after_registration = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
auth.messages.verify_email = 'Click on the link http://' + \
request <http://127.0.0.1:8000/examples/global/vars/request>.env.http_host
+ \
URL <http://127.0.0.1:8000/examples/global/vars/URL>(r=request
<http://127.0.0.1:8000/examples/global/vars/request>,f='user',args=['verify_email'])
+ \
'/%(key)s to verify your email'
auth.messages.reset_password = 'Click on the link http://' + \
request <http://127.0.0.1:8000/examples/global/vars/request>.env.http_host
+ \
URL <http://127.0.0.1:8000/examples/global/vars/URL>(r=request
<http://127.0.0.1:8000/examples/global/vars/request>,f='user',args=['reset_password'])
+ \
'/%(key)s to reset your password'
auth.settings.register_next = URL
<http://127.0.0.1:8000/examples/global/vars/URL>('dashboard')
auth.settings.login_url = URL
<http://127.0.0.1:8000/examples/global/vars/URL>('login')
auth.settings.login_next = URL
<http://127.0.0.1:8000/examples/global/vars/URL>('dashboard')
auth.settings.logout_next = URL
<http://127.0.0.1:8000/examples/global/vars/URL>('index')
but when I try registering a new user, it does not redirect to the
dashboard as I'd like it to.
On Sunday, November 18, 2012 10:51:14 PM UTC, Daniele wrote:
>
> Hey guys, I would like to set register_next to move on to a URL upon
> successful registration. However, it seems to be redirecting me to the
> login page right now. I believe this is because I have
>
> @auth.requires_login()
> def mypage:
>
> in the controller. How can I make it so that when a user registers, the
> page automatically is redirected to a page I specify?
>
> Thanks!
>
--