Comments (3)
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.
What is the URL that appears in the address bar when you are seeing the login page in the browser?
from microblog.
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)
- Chapter 22 Export task stuck at 0% HOT 5
- elastic_transport.ConnectionError when post is submitted? HOT 6
- Language inconsistency during poedit translation process? HOT 7
- Using JinJa2 filter function truncate to implement 'Read more'? HOT 21
- Bug in lesson 5 due to werkzeug.urls - url parsing removed HOT 4
- Lesson 6, FLASK_ENV is removed from Flask 2.3.0 HOT 2
- Unable to load celery application. 'str' object has no attribute 'level' when Integrating Celery with Flask? HOT 17
- Unable to import 'url_parse' from 'werkzeug.urls' in flask shell execution HOT 15
- login error was reported during deployment? HOT 7
- Github links in chapters start with wrong tag (one-off) HOT 2
- Dead link to flask-babel docs HOT 1
- flask_moment error when trying to format HOT 4
- Multidict Package Problematic in python:slim HOT 1
- Error: Cannot import name 'app' from 'app' HOT 2
- Exporting a huge number of database records HOT 3
- ImportError...circular import HOT 3
- Chp 4 udemy course: Video 27 Time 1 min: db.sessions.add(u) Generates Error
- Tagging system HOT 3
- Chapter 7 -Listing 63: Email without from-adress and subject HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microblog.