[web2py] Re: How to get register_next to move on to the desired URL

2012-11-24 Thread Anthony

>
> Yes I have that already.


Note, your code shows auth.settings.login_after_registration = False.
 

> I'm starting to think that the problem is with my controller, not with the 
> db.py settings.

Maybe my controller is not actually registering the users?
> Here's the controller for the signup:
>
> def signup():
> if auth.is_logged_in():
> redirect (URL 
> ('dashboard'))
> response .subtitle = 
> T ("Sign up")
> form = SQLFORM 
> (auth.settings.table_user,
> separator = '', _class='form-horizontal')
> if form.process().accepted:
> mail.send('em...@gmail.com ', 'Message subject', 'Plain 
> text body of the message')
> return dict(form=form)
>
>
Why not use the built-in registration action? Among other things, the 
built-in action will log in the user if 
auth.settings.login_after_registration is True or 
auth.settings.registration_requires_verification is False (your action does 
not do that). It also logs the registration event in the auth_event table. 
If you really feel the need to create your own registration action, it 
might be a good idea to check the code of the built-in action to see what 
it does: http://code.google.com/p/web2py/source/browse/gluon/tools.py#2147.

Anthony

-- 





[web2py] Re: How to get register_next to move on to the desired URL

2012-11-24 Thread Daniele
Yes I have that already. I'm starting to think that the problem is with my 
controller, not with the db.py settings.
Maybe my controller is not actually registering the users?
Here's the controller for the signup:

def signup():
if auth.is_logged_in():
redirect (URL 
('dashboard'))
response .subtitle = T 
("Sign up")
form = SQLFORM 
(auth.settings.table_user,
separator = '', _class='form-horizontal')
if form.process().accepted:
mail.send('em...@gmail.com', 'Message subject', 'Plain text body of the 
message')
return dict(form=form)






On Saturday, November 24, 2012 3:45:09 AM UTC, Anthony wrote:
>
> Does the dashboard page require login? If so, that's why it is redirecting 
> to the login page. If you want the user to be logged in automatically after 
> registration, you can do:
>
> auth.settings.login_after_registration = True
>
>
> Anthony
>
> On Friday, November 23, 2012 8:34:01 AM UTC-5, Daniele wrote:
>>
>> I still cannot get this to work. Any tips?
>>
>> 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!
>>>
>>

-- 





[web2py] Re: How to get register_next to move on to the desired URL

2012-11-23 Thread Anthony
Does the dashboard page require login? If so, that's why it is redirecting 
to the login page. If you want the user to be logged in automatically after 
registration, you can do:

auth.settings.login_after_registration = True


Anthony

On Friday, November 23, 2012 8:34:01 AM UTC-5, Daniele wrote:
>
> I still cannot get this to work. Any tips?
>
> 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!
>>
>

-- 





[web2py] Re: How to get register_next to move on to the desired URL

2012-11-23 Thread Daniele
I still cannot get this to work. Any tips?

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!
>

-- 





[web2py] Re: How to get register_next to move on to the desired URL

2012-11-19 Thread Daniele
Here's my registration form:

db.define_table(
auth.settings.table_user_name,
Field ('email', 
length=128, default=''),
Field ('password', 
'password', length=512, readable=False),
Field ('password_verify', 
'password', length=512, readable=False),
Field 
('registration_time', 
'datetime', requires=IS_DATETIME 
(), writable=False, 
readable=False, default=request 
.utcnow),
Field 
('registration_key', 
length=512, writable=False, readable=False, default=''),
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 
(error_message='Please 
input an email address'),
IS_EMAIL 
(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB 
(db, 
custom_auth_table.email)]
custom_auth_table.password.requires = [
IS_NOT_EMPTY 
(error_message='Please 
type a password'),
IS_STRONG (min=8, 
special=0, upper=1),
CRYPT ()]
custom_auth_table.password_verify.requires = [
IS_NOT_EMPTY 
(error_message='Please 
retype your password'),
IS_EQUAL_TO 
(request 
.vars.password, 
error_message='Passwords do not match'),
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 .env.http_host 
+ \
URL (r=request 
,f='user',args=['verify_email'])
 + \
'/%(key)s to verify your email'
auth.messages.reset_password = 'Click on the link http://' + \
request .env.http_host 
+ \
URL (r=request 
,f='user',args=['reset_password'])
 + \
'/%(key)s to reset your password'

auth.settings.register_next = URL 
('dashboard')
auth.settings.login_url = URL 
('login')
auth.settings.login_next = URL 
('dashboard')
auth.settings.logout_next = 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!
>

-- 





[web2py] Re: How to get register_next to move on to the desired URL

2012-11-19 Thread Daniele
I had already tried that but it doesn't seem to be working for me. Could 
this be because I am using a custom sign up form? The registration is 
working properly though, which is odd...



On Monday, November 19, 2012 4:45:52 PM UTC, peter wrote:
>
>
> # Instructions: Copy all of this into your db.py, and make the one change 
> in layout.html
>
> # Solution: how to have a user redirected to a page AFTER register
> # in this example, the URL('user/profile') will be used.
>
>
> # app name: AuthRedirect  <- just a NEW application, with no modication
> # web2py Version 2.2.1 (2012-10-21 16:57:04) stable
>
> # - - - - -
> # in layout.html view, modify the line:
> # {{='auth' in globals() and 
> auth.navbar(mode="dropdown") or ''}}
> # to
> # {{='auth' in globals() and 
> auth.navbar(mode="dropdown",referrer_actions=None) or ''}}
> # this will cause the URL not to display
> # 
> http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
>  
> # but rather
> # http://127.0.0.1:8000/AuthRedirect/default/user/
>
>
> # - - - - -
> # one line of CODE BELOW placed in : 
>
> # /models/db.py - located BELOW the  setting under > ## configure auth 
> policy lines
>
> auth.settings.register_next = URL('user/profile') 
>
> Peter
>
> On Sunday, 18 November 2012 22:51:14 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!
>>
>

-- 





[web2py] Re: How to get register_next to move on to the desired URL

2012-11-19 Thread peter

# Instructions: Copy all of this into your db.py, and make the one change 
in layout.html

# Solution: how to have a user redirected to a page AFTER register
# in this example, the URL('user/profile') will be used.


# app name: AuthRedirect  <- just a NEW application, with no modication
# web2py Version 2.2.1 (2012-10-21 16:57:04) stable

# - - - - -
# in layout.html view, modify the line:
# {{='auth' in globals() and 
auth.navbar(mode="dropdown") or ''}}
# to
# {{='auth' in globals() and 
auth.navbar(mode="dropdown",referrer_actions=None) or ''}}
# this will cause the URL not to display
# 
http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
 
# but rather
# http://127.0.0.1:8000/AuthRedirect/default/user/


# - - - - -
# one line of CODE BELOW placed in : 

# /models/db.py - located BELOW the  setting under > ## configure auth 
policy lines

auth.settings.register_next = URL('user/profile') 

Peter

On Sunday, 18 November 2012 22:51:14 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!
>

--