Got rid of prefix again, that will only help for common software anyways.
This commit is contained in:
parent
ca4299ac95
commit
dffba5bfbf
@ -29,11 +29,7 @@ class PasteController(BaseController):
|
||||
language = 'text'
|
||||
pastes = session.query(Paste)
|
||||
show_captcha = False
|
||||
|
||||
# prefix all form fields with the a portion of the user hash
|
||||
# this should fight some stupid bots
|
||||
prefix = ctx.request.cookies.get('user_hash', '')[2:14]
|
||||
getform = lambda x: ctx.request.form.get(prefix + x)
|
||||
getform = ctx.request.form.get
|
||||
|
||||
if ctx.request.method == 'POST':
|
||||
code = getform('code')
|
||||
@ -72,8 +68,7 @@ class PasteController(BaseController):
|
||||
code=code,
|
||||
language=language,
|
||||
error=error,
|
||||
show_captcha=show_captcha,
|
||||
prefix=prefix
|
||||
show_captcha=show_captcha
|
||||
)
|
||||
|
||||
def show_paste(self, paste_id, raw=False):
|
||||
|
@ -3,27 +3,27 @@
|
||||
{% set active_page = 'new' %}
|
||||
{% block body %}
|
||||
<form action="/" method="post" class="submitform">
|
||||
{%- if error %}
|
||||
<div class="notification">
|
||||
<h3>Error While Pasting</h3>
|
||||
<p>Could not submit your paste because {{ error|e }}.</p>
|
||||
{%- if show_captcha %}
|
||||
<div class="captcha">
|
||||
<p>Please fill out the CAPTCHA to proceed:</p>
|
||||
<img src="/_captcha.png" alt="a captcha you can't see. Sorry :(">
|
||||
<input type="text" name="{{ prefix }}captcha" size="20">
|
||||
{%- if error %}
|
||||
<div class="notification">
|
||||
<h3>Error While Pasting</h3>
|
||||
<p>Could not submit your paste because {{ error|e }}.</p>
|
||||
{%- if show_captcha %}
|
||||
<div class="captcha">
|
||||
<p>Please fill out the CAPTCHA to proceed:</p>
|
||||
<img src="/_captcha.png" alt="a captcha you can't see. Sorry :(">
|
||||
<input type="text" name="captcha" size="20">
|
||||
</div>
|
||||
{%- else %}
|
||||
<p><a href="javascript:LodgeIt.hideNotification()">hide this message</a></p>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{%- else %}
|
||||
<p><a href="javascript:LodgeIt.hideNotification()">hide this message</a></p>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
{% if parent %}
|
||||
<input type="hidden" name="{{ prefix }}parent" value="{{ parent.paste_id }}">
|
||||
{% endif %}
|
||||
<textarea name="{{ prefix }}code" rows="10" cols="80">{{ code|e }}</textarea>
|
||||
<select name="{{ prefix }}language">
|
||||
{%- for key, caption in languages|dictsort(true, 'value') -%}
|
||||
{%- endif %}
|
||||
{%- if parent %}
|
||||
<input type="hidden" name="parent" value="{{ parent.paste_id }}">
|
||||
{%- endif %}
|
||||
<textarea name="code" rows="10" cols="80">{{ code|e }}</textarea>
|
||||
<select name="language">
|
||||
{%- for key, caption in languages|dictsort(true, 'value') %}
|
||||
<option value="{{ key }}"{% if language == key
|
||||
%} selected="selected"{% endif %}>{{ caption|e }}</option>
|
||||
{%- endfor %}
|
||||
|
@ -32,10 +32,10 @@
|
||||
</form></li>
|
||||
<li>select different colorscheme <form action="/colorscheme/" method="post">
|
||||
<select name="style">
|
||||
{% for key, caption in styles|dictsort %}
|
||||
{%- for key, caption in styles|dictsort %}
|
||||
<option value="{{ key }}"{% if key == style
|
||||
%} selected="selected"{% endif %}>{{ caption }}</option>
|
||||
{% endfor %}
|
||||
{%- endfor %}
|
||||
</select>
|
||||
<input type="submit" value="change">
|
||||
</form></li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user