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