##// END OF EJS Templates
helpers: make sure request parameter is not rendered inside secure form.
marcink -
r2088:4558ec55 default
parent child Browse files
Show More
@@ -1890,7 +1890,7 b" def form(url, method='post', needs_csrf_"
1890 1890 return wh_form(url, method=method, **attrs)
1891 1891
1892 1892
1893 def secure_form(url, method="POST", multipart=False, **attrs):
1893 def secure_form(form_url, method="POST", multipart=False, **attrs):
1894 1894 """Start a form tag that points the action to an url. This
1895 1895 form tag will also include the hidden field containing
1896 1896 the auth token.
@@ -1910,13 +1910,15 b' def secure_form(url, method="POST", mult'
1910 1910
1911 1911 """
1912 1912 from webhelpers.pylonslib.secure_form import insecure_form
1913 form = insecure_form(url, method, multipart, **attrs)
1914 1913
1915 1914 session = None
1915
1916 1916 # TODO(marcink): after pyramid migration require request variable ALWAYS
1917 1917 if 'request' in attrs:
1918 1918 session = attrs['request'].session
1919 del attrs['request']
1919 1920
1921 form = insecure_form(form_url, method, multipart, **attrs)
1920 1922 token = literal(
1921 1923 '<input type="hidden" id="{}" name="{}" value="{}">'.format(
1922 1924 csrf_token_key, csrf_token_key, get_csrf_token(session)))
General Comments 0
You need to be logged in to leave comments. Login now