On Feb 3, 2011, at 12:15 AM, Prashanth wrote:
> 
> If _next is set with some value ( eg: _next='myapp/default/show_id' :
> show_id has @auth.login_required ) .. set_domain method will not get
> called and it just redirects to the value set in _next variable in
> which case I will not be able the redirect to username.mydomain.com.
> 
> 
> How can I work this out.. or is their any better approach to achieve
> this?

To tell the truth, I get a little confused by this logic myself. 

One possibility: suppose your ultimate destination after login is default/index 
in the user's domain. Go ahead and let login go there (I think it does by 
default), and inside that function do the domain redirect conditionally if 
http_host isn't already set to the user's domain.

Another possibility: create a decorator along the lines of auth.requires_login 
that does a conditional redirect to set the domain. Keep in mind that you can 
use multiple decorators, so you can first check for login, and then for the 
correct domain. Then any function that requires a logged-in user can also check 
the subdomain and redirect if necessary.

Reply via email to