pyramid view redirection
Posted
by
ascobol
on Stack Overflow
See other posts from Stack Overflow
or by ascobol
Published on 2012-11-30T15:01:38Z
Indexed on
2012/11/30
17:04 UTC
Read the original article
Hit count: 252
This question title may be slightly incorrect but I could not find a better one (yet).
I'm trying to integrate Mozilla Persona (browserid) into a Pyramid application. The login process is:
- user can login on any page by clicking on the login button
- a popup then shows a login form
- when the users enters correct login/password, an ajax call is made by the popup to a pyramid view that checks users credentials, and calls pyramid remember function if the check succeeded
- the browserid javascript code then reloads the current page
Now I want to handle the case of a new user subscribing to the web app and present a new view asking for a few more details (desired username, etc)
Since the "remember" function is called by an ajax call from the popup, I cannot redirect the user the the "/newuser" page. So every view needs to redirect new users to the "/newuser" url whenever the remembered browserid has no corresponding user in the database.
Is there a way to intercept user requests before calling a view to call the "new_user" view instead ?
Or maybe my authentication approach is fundamentally incorrect and I should rely on another approach ?
© Stack Overflow or respective owner