Commit 3444b9b9 authored by buttle's avatar buttle

Fixed static file requests.

parent ea8fec95
......@@ -32,7 +32,7 @@ babel = Babel(app)
csrf = CSRFProtect()
app.config['APP_VERSION'] = 34
app.config['APP_VERSION'] = 35
app.config['SCHEMA_VERSION'] = 13
app.config['RESERVED_SLUGS'] = ['login', 'static', 'admin', 'admins', 'user', 'users',
......@@ -730,7 +730,7 @@ class Installation(db.Document):
return None
print('Schema already up to date')
def isUser(cls, email):
def isUser(email):
return True if User.objects(email=email).first() else False
......@@ -2,8 +2,8 @@
<meta charset="utf-8">
<title>{{ }}</title>
<link rel="shortcut icon" type="image/png" href="{{}}"/>
<title>{% if %}{{ }}{% endif %}</title>
<link rel="shortcut icon" type="image/png" href="{% if %}{{}}{% endif %}"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="/static/jquery/jquery.min.js"></script>
<script src="/static/jquery/jquery-ui.min.js"></script>
......@@ -79,12 +79,19 @@ def anon_required(f):
def sanitized_slug_required(f):
def wrap(*args, **kwargs):
if not ('slug' in kwargs and kwargs['slug'] == sanitizeSlug(kwargs['slug'])):
if not 'slug' in kwargs:
if g.current_user:
flash(gettext("That's a nasty slug!"), 'warning')
flash("No slug found!", 'error')
return render_template('page-not-found.html'), 404
return f(*args, **kwargs)
if kwargs['slug'] in app.config['RESERVED_SLUGS']:
if g.current_user:
flash("Reserved slug!", 'warning')
return render_template('page-not-found.html'), 404
if kwargs['slug'] != sanitizeSlug(kwargs['slug']):
if g.current_user:
flash("That's a nasty slug!", 'warning')
return render_template('page-not-found.html'), 404
return f(*args, **kwargs)
return wrap
def sanitized_key_required(f):
......@@ -38,13 +38,14 @@ def make_url_for(function, **kwargs):
return url_for(function, **kwargs)
def before_request():
def before_request():
if '/static' in request.path:
if request.path[0:7] == '/static':
if 'user_id' in session and session["user_id"] != None:
if not g.current_user:
......@@ -64,8 +65,6 @@ def get_locale():
def page_not_found(error):
if not
return render_template('page-not-found.html'), 400
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment