Code Monkey home page Code Monkey logo

Comments (3)

miguelgrinberg avatar miguelgrinberg commented on June 5, 2024 1

I guess you can. I'm not sure if it makes sense outside of a login flow, but request.args.get('next') should give you whatever is in the next argument. You can add it to the action URL like this:

<form method="POST" action="{{ url_for('session_store', next=request.args.get('next')) }}">

from microblog.

miguelgrinberg avatar miguelgrinberg commented on June 5, 2024

What is the URL that appears in the address bar when you are seeing the login page in the browser?

from microblog.

drewbutcher avatar drewbutcher commented on June 5, 2024

It was my fault.. I had an action defined in the form
<form method="POST" action="{{ url_for('session_store') }}">
so even with the URL having the next value
http://127.0.0.1:5000/login?next=%2F
the post call didn't include the next value... I saw it on the printout after cloning your repository.

Here was the print out with the form action defined:
127.0.0.1 - - [31/Jan/2024 21:44:00] "GET / HTTP/1.1" 302 -
127.0.0.1 - - [31/Jan/2024 21:44:00] "GET /login?next=/ HTTP/1.1" 200 -
127.0.0.1 - - [31/Jan/2024 21:44:14] "POST /login HTTP/1.1" 302 -
127.0.0.1 - - [31/Jan/2024 21:44:14] "GET /drewbutcher HTTP/1.1" 200 -

Here was the printout without the form action defined:
127.0.0.1 - - [31/Jan/2024 21:49:15] "GET / HTTP/1.1" 302 -
127.0.0.1 - - [31/Jan/2024 21:49:15] "GET /login?next=/ HTTP/1.1" 200 -
127.0.0.1 - - [31/Jan/2024 21:49:20] "POST /login?next=/ HTTP/1.1" 302 -
127.0.0.1 - - [31/Jan/2024 21:49:20] "GET / HTTP/1.1" 200 -

Can you use somehow add the request.args.get('next') into the form action with url_for?

from microblog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.