问题描述:

I wrote middleware that process requests from admin log in page. How can I redirect user after authentication to some intermediate page with some 'Continue' button and this button will redirect me to page which should be showed in standard scenario.

I set my middleware after AuthenticationMiddleware in settings list. Despite of this if I set some return statement in my middleware, user authentication process fails.

I need this to show some additional info about authentication results on some Atlassian services. Don't want to do it via JavaScript so decided to implement intermediate page functionality.

网友答案:

Instead of using a middleware, create a template with that auth information and use the function render_to_response at the end of your login view to render that template. You can add variables to this function to give extra information.

Example:

return render_to_response('my_template.html',
                      my_data_dictionary,
                      context_instance=RequestContext(request))
相关阅读:
Top