Correct regex with non-wildcard, always check name
This commit is contained in:
parent
7448cd90da
commit
5b8f62a16c
@ -216,7 +216,7 @@ def ssh_public_keys():
|
|||||||
name = parts[0]
|
name = parts[0]
|
||||||
else:
|
else:
|
||||||
errors.append("Name is required")
|
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_@. -]+$\"")
|
errors.append("Name must match \"^[0-9A-Za-z_@. -]+$\"")
|
||||||
|
|
||||||
if method == "POST":
|
if method == "POST":
|
||||||
@ -225,7 +225,7 @@ def ssh_public_keys():
|
|||||||
errors.append("Content is required")
|
errors.append("Content is required")
|
||||||
else:
|
else:
|
||||||
content = content.replace("\r", "").replace("\n", "")
|
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+/_=@. -]+$\"")
|
errors.append("Content must match \"^(ssh|ecdsa)-[0-9A-Za-z+/_=@. -]+$\"")
|
||||||
|
|
||||||
if get_model().ssh_public_key_name_exists(session["account"], name):
|
if get_model().ssh_public_key_name_exists(session["account"], name):
|
||||||
|
Loading…
Reference in New Issue
Block a user