Commit d2ab8626 authored by Jacotsu's avatar Jacotsu Committed by JackV
Browse files

Now the click counter is not incremented when the referer header is

 an injection
parent a3b187bd
......@@ -34,7 +34,6 @@ def handle_redirect(path):
if pure_string.match(path):
final_url = redis_store.get('url.' + path)
if final_url:
redis_store.incr('count.' + path)
referrer = flask.request.headers.get('referer')
if referrer:
safe_referrer = flask.escape(referrer)
......@@ -52,6 +51,8 @@ def handle_redirect(path):
redis_store.incr(redis_key_for_referrer_count(path,
safe_referrer))
app.logger.debug('Increased counter for {}'.format(safe_referrer))
redis_store.incr('count.' + path)
return flask.redirect(final_url)
else:
return flask.abort(404)
......
......@@ -21,7 +21,7 @@ def cli(redisurl):
def adduser(username, passwd):
"""Add UUS admin user"""
cryptpwd = crypt.crypt(passwd)
redis_store.set('user.' + username, cryptpwd)
redis_store.set('usr.' + username, cryptpwd)
@cli.command()
......@@ -36,7 +36,7 @@ def passwd(username, passwd):
@click.argument("username")
def deluser(username):
"""Delete UUS admin user"""
redis_store.delete('user.' + username)
redis_store.delete('usr.' + username)
if __name__ == '__main__':
......
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