Correct regex with non-wildcard, always check name

This commit is contained in:
j3s 2020-05-17 14:19:10 -05:00
parent 7448cd90da
commit 5b8f62a16c

View File

@ -216,7 +216,7 @@ def ssh_public_keys():
name = parts[0]
else:
errors.append("Name is required")
elif not re.match(r"^[0-9A-Za-z_@. -]+$", name):
if not re.match(r"^[0-9A-Za-z_@\. -]+$", name):
errors.append("Name must match \"^[0-9A-Za-z_@. -]+$\"")
if method == "POST":
@ -225,7 +225,7 @@ def ssh_public_keys():
errors.append("Content is required")
else:
content = content.replace("\r", "").replace("\n", "")
if not re.match(r"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$", content):
if not re.match(r"^(ssh|ecdsa)-[0-9A-Za-z+/_=@\. -]+$", content):
errors.append("Content must match \"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$\"")
if get_model().ssh_public_key_name_exists(session["account"], name):