[enh] reset default preferences

This commit is contained in:
Adam Tauber 2015-04-07 11:07:48 +02:00
parent 54f1bc0425
commit 1184f45ca5
4 changed files with 13 additions and 2 deletions

View file

@ -125,6 +125,7 @@
</p> </p>
<input type="submit" value="{{ _('save') }}" /> <input type="submit" value="{{ _('save') }}" />
<div class="right preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div>
<div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> <div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
</form> </form>
</div> </div>

View file

@ -113,6 +113,7 @@
</p> </p>
<input type="submit" value="{{ _('save') }}" /> <input type="submit" value="{{ _('save') }}" />
<div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('clear_cookies') }}">{{ _('Reset defaults') }}</a></div>
<div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
</form> </form>
</div> </div>

View file

@ -184,6 +184,7 @@
<input type="submit" class="btn btn-primary" value="{{ _('save') }}" /> <input type="submit" class="btn btn-primary" value="{{ _('save') }}" />
<a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a> <a href="{{ url_for('index') }}"><div class="btn btn-default">{{ _('back') }}</div></a>
<a href="{{ url_for('clear_cookies') }}"><div class="btn btn-default">{{ _('Reset defaults') }}</div></a>
</form> </form>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -715,6 +715,14 @@ def favicon():
mimetype='image/vnd.microsoft.icon') mimetype='image/vnd.microsoft.icon')
@app.route('/clear_cookies')
def clear_cookies():
resp = make_response(redirect(url_for('index')))
for cookie_name in request.cookies:
resp.delete_cookie(cookie_name)
return resp
def run(): def run():
app.run( app.run(
debug=settings['server']['debug'], debug=settings['server']['debug'],