problem description
I am currently learning this book through Flask Web. Now I have learned Chapter 8. When I implement the re-authentication using hook Filter users to another interface when the user does not confirm their identity, I find that as long as I log in with the registered account, 127.0.0.1 will redirect you too many times. This is a problem
.the environmental background of the problems and what methods you have tried
I can"t even start cookie after cleaning up according to what I said on the Internet.
related codes
@auth.before_app_request -sharp
def before_request():
-sharp
if current_user.is_authenticated() \
and not current_user.confirmed \
and request.endpoint \
and request.blueprint[:5] != "auth." \
and request.endpoint != "static":
return redirect(url_for("auth.unconfirmed"))
-sharp
@auth.route("/unconfirmed")
def unconfirmed():
if current_user.is_anonymous or current_user.confirmed:
return redirect(url_for("main.index"))
return render_template("auth/unconfirmed.html")
:
F:\\flasky\project>python manage.py
* Restarting with stat
* Debugger is active!
* Debugger PIN: 170-786-910
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2
127.0.0.1 - - [12/Nov/2018 16:15:23] "GET / HTTP/1.1" 302 -
2
127.0.0.1 - - [12/Nov/2018 16:15:23] "GET /auth/unconfirmed HTTP/1.1" 302 -
2
127.0.0.1 - - [12/Nov/2018 16:15:23] "GET /auth/unconfirmed HTTP/1.1" 302 -
2
127.0.0.1 - - [12/Nov/2018 16:15:23] "GET /auth/unconfirmed HTTP/1.1" 302 -
2
127.0.0.1 - - [12/Nov/2018 16:15:23] "GET /auth/unconfirmed HTTP/1.1" 302 -
2
seems to keep calling the function unconfirmed ()
.