make ssh key name default to key comment
This commit is contained in:
parent
bae9c2311d
commit
fda3c1040a
@ -168,9 +168,17 @@ def ssh_public_keys():
|
|||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
method = request.form["method"]
|
method = request.form["method"]
|
||||||
|
content = None
|
||||||
|
|
||||||
name = request.form["name"]
|
name = request.form["name"]
|
||||||
if not name or len(name.strip()) < 1:
|
if not name or len(name.strip()) < 1:
|
||||||
|
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")
|
errors.append("Name is required")
|
||||||
elif not re.match(r"^[0-9A-Za-z_@. -]+$", name):
|
elif 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_@. -]+$\"")
|
||||||
|
@ -24,17 +24,17 @@
|
|||||||
{% if has_ssh_public_keys %} <hr/> {% endif %}
|
{% if has_ssh_public_keys %} <hr/> {% endif %}
|
||||||
|
|
||||||
<div class="third-margin">
|
<div class="third-margin">
|
||||||
<h1>UPLOAD A NEW SSH KEY</h1>
|
<h1>UPLOAD A NEW SSH PUBLIC KEY</h1>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="method" value="POST"></input>
|
<input type="hidden" name="method" value="POST"></input>
|
||||||
<div class="row justify-start">
|
<div class="row justify-start">
|
||||||
<label class="align" for="name">Name</label>
|
<label class="align" for="content">File Contents</label>
|
||||||
<input type="text" id="name" name="name"></input>
|
<textarea class="expand" id="content" name="content"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-start">
|
<div class="row justify-start">
|
||||||
<label class="align" for="content">Content</label>
|
<label class="align" for="name">Key Name</label>
|
||||||
<textarea class="expand" id="content" name="content"></textarea>
|
<input type="text" id="name" name="name"></input> (defaults to key comment)
|
||||||
</div>
|
</div>
|
||||||
<div class="smalltext">
|
<div class="smalltext">
|
||||||
<p>Paste the contents of your SSH public key file here.
|
<p>Paste the contents of your SSH public key file here.
|
||||||
|
Loading…
Reference in New Issue
Block a user