Home > other >  Flask in the address bar, please how to hide out url_for parameters passed
Flask in the address bar, please how to hide out url_for parameters passed

Time:11-21

To teacher_info view function in the login view function with url_for pass the username parameter:
 
@ app. The route ('/login/', the methods=[' GET 'and' POST '])
Def the login () :
Return redirect (url_for (' teacher_info 'username=' * * ')) # use url_for (' teacher_info 'username=' Joe ', _method='POST') are not

 
@ app. The route ('/teacher_info/', the methods=[' GET 'and' POST '])
Def teacher_info () :
.
Return render_template (' teacher_info. HTML)

CodePudding user response:

refer to the original poster Kenny. Feng response:
to teacher_info view function in the login view function with url_for pass the username parameter:
 
@ app. The route ('/login/', the methods=[' GET 'and' POST '])
Def the login () :
Return redirect (url_for (' teacher_info 'username=' * * ')) # use url_for (' teacher_info 'username=' Joe ', _method='POST') are not

 
@ app. The route ('/teacher_info/', the methods=[' GET 'and' POST '])
Def teacher_info () :
.
Return render_template (' teacher_info. HTML)


The front it is ok to use CSRF encryption, add a form is the form. The csrf_token

CodePudding user response:

Well well, thanks

CodePudding user response:

Form form post user=request. Form. The get (' user ') post that!!
  • Related