diff --git a/capsulflask/console.py b/capsulflask/console.py index bc3ede1..322b1e4 100644 --- a/capsulflask/console.py +++ b/capsulflask/console.py @@ -168,10 +168,18 @@ def ssh_public_keys(): if request.method == "POST": method = request.form["method"] + content = None name = request.form["name"] if not name or len(name.strip()) < 1: - errors.append("Name is required") + if method == "POST": + parts = re.split(" +", request.form["content"]) + if len(parts) > 2 and len(parts[2].strip()) > 0: + name = parts[2] + else: + name = parts[0] + else: + errors.append("Name is required") elif not re.match(r"^[0-9A-Za-z_@. -]+$", name): errors.append("Name must match \"^[0-9A-Za-z_@. -]+$\"") diff --git a/capsulflask/templates/ssh-public-keys.html b/capsulflask/templates/ssh-public-keys.html index e1805a3..fc569bc 100644 --- a/capsulflask/templates/ssh-public-keys.html +++ b/capsulflask/templates/ssh-public-keys.html @@ -24,17 +24,17 @@ {% if has_ssh_public_keys %}
{% endif %}
-

UPLOAD A NEW SSH KEY

+

UPLOAD A NEW SSH PUBLIC KEY

- - + +
- - + + (defaults to key comment)

Paste the contents of your SSH public key file here.