diff options
author | marc <mlasch@mailbox.org> | 2019-08-15 14:36:55 +0200 |
---|---|---|
committer | marc <mlasch@mailbox.org> | 2019-08-15 14:36:55 +0200 |
commit | d564b1e8f9e9155169d84b85d5ca6464515f1552 (patch) | |
tree | f6c5b7613ef1aa0c5432ddfd6aab0786fa5f11ab /guard/templates.py | |
parent | 5f60e7ba37e50964827e59f2a9079408bd0113b8 (diff) | |
download | influxdb-guard-d564b1e8f9e9155169d84b85d5ca6464515f1552.tar.gz influxdb-guard-d564b1e8f9e9155169d84b85d5ca6464515f1552.zip |
Added config option for default token length
Diffstat (limited to 'guard/templates.py')
-rw-r--r-- | guard/templates.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/guard/templates.py b/guard/templates.py index 3cc1373..d1baa7e 100644 --- a/guard/templates.py +++ b/guard/templates.py @@ -38,19 +38,20 @@ def _index_access(accesses: Iterable[model.Access]): ), accesses) -def index(serverport: str, cookiename: str) -> str: +def index(config: type) -> str: return _html( E.head( E.title("Manage access tokens"), + E.script("const TOKEN_LENGTH = {};".format(config['gen_token_len'])), E.script("", src="static/main.js") ), E.body(E.div( E.p(E.a("Logout", href=url_for("logout"))), E.p("Call the write-service like: ", - E.pre("http://thisMachine:{}/write".format(serverport)), - "with the token in a cookie named {}".format(cookiename)), + E.pre("http://thisMachine:{}/write".format(config['port'])), + "with the token in a cookie named {}".format(config['cookiename'])), E.p("Or directly in the url: ", - E.pre("http://thisMachine:{}/write/<token>".format(serverport))), + E.pre("http://thisMachine:{}/write/<token>".format(config['port']))), E.form( E.input(type="hidden", name="action", value="create"), E.input(name="token", placeholder="Token secret", id="tokenField"), @@ -62,7 +63,7 @@ def index(serverport: str, cookiename: str) -> str: E.hr(), E.table( E.tr( - E.th("cookie: " + cookiename + " value"), E.th("Pattern"), + E.th("cookie: " + config['cookiename'] + " value"), E.th("Pattern"), E.th("Create Date"), E.th("Comment"), E.th() ), border="1", style="width: 100%", *_index_access(model.Access.select().order_by(model.Access.create_date)) |