Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:11:06+00:00 2026-06-15T12:11:06+00:00

I’m trying to integrate Mozilla Persona (browserid) into a Pyramid application. The login process

  • 0

I’m trying to integrate Mozilla Persona (browserid) into a Pyramid application. The login process is:

  1. user can login on any page by clicking on the login button
  2. a popup then shows a login form
  3. 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
  4. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:11:07+00:00Added an answer on June 15, 2026 at 12:11 pm

    One way to do this would be to create an exception that should be raised when the user is created, and use this exception as the context of a view that would redirect to the new page.

    class NewUser(Exception):
        pass
    
    @view_config(context=NewUser)
    def new_user_exception(request):
        return HTTPFound(request.route_path('new_user'))
    

    Make sure the exception is raised during the first request after the first login (after having created the user object, for example), and the user will be redirected to the right page.

    You could also put the code for the welcome page directly in new_user_exception, but without redirection, this page would have the url asked by the user, whatever it was.


    Another solution would be to tweak how the persona part is done. For that, I’m going to guess you are using pyramid_persona (I’m the writer 🙂 ). If not, what I’m saying will still apply, and will be even simpler to do.

    What you could do is :

    • Change the login view so that it includes in the response a boolean saying whether this is the first login or not.
    • Change the javascript to check this boolean, reload the page if it’s not the first time, and redirect to the welcome page if it.

    The code for the login view can use pyramid_persona’s login view like this :

    from pyramid_persona.views import login
    
    @view_config(route_name='login')
    def new_login(request):
        response = login(request)
        if response.status == 200: #the login worked
            # tweak the response
        return response
    

    EDIT : There’s now a part about this in pyramid_persona’s documentation : Do extra work or verification at login.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.