vpn: fix key name regex

This commit is contained in:
Timotej Lazar 2024-04-25 12:20:51 +02:00
parent 2ebc87f308
commit f8d71b7b06
2 changed files with 2 additions and 2 deletions

View file

@ -40,7 +40,7 @@ Na vsaki napravi, ki jo želite povezati v omrežje FRI, ustvarite nov ključ. P
<p>
<label for="name">Ime naprave</label><br>
<input id="name" name="name" pattern="[.-_A-Za-z0-9 ]*" maxlength="16" placeholder="A-Z a-z 0-9 . _ - " />
<input id="name" name="name" pattern="[-._A-Za-z0-9 ]*" maxlength="16" placeholder="A-Z a-z 0-9 . _ - " />
<button id="submit" type="submit">Ustvari ključ</button>
<p>
<input type="checkbox" id="add_default" name="add_default" />

View file

@ -63,7 +63,7 @@ def new():
else:
return flask.Response('no more available IP addresses', status=500, mimetype='text/plain')
now = datetime.datetime.utcnow()
name = re.sub('[^\w ]', '', flask.request.json.get('name', ''))
name = re.sub('[^-._A-Za-z0-9]', '', flask.request.json.get('name', ''))
keys[str(ip)] = {
'key': pubkey,