add sshpubkey file processing and uploading

Signed-off-by: Toshaan Bharvani <toshaan@vantosh.com>
remotes/1690132257852795115/master
Toshaan Bharvani 2 years ago
parent fe842834d0
commit ddf935e5c3

@ -7,12 +7,14 @@ var goal = "{{ .Site.Params.forms.hub.goal }}";
{{ end }} {{ end }}
</script> </script>
<section id="hub"> <section id="hub">
<div class="container"><div class="row wow fadeInUp"> <div class="container"><div class="row">
<div class="col-lg-12 col-md-12 mt-5 mb-5"><div class="form"> <div class="col-lg-12 col-md-12 mt-5 mb-5"><div class="form">
<div class="col-lg-12 text-center"><h2>HUB Access Request Form</h2></div> <div class="col-lg-12 text-center"><h2>HUB Access Request Form</h2></div>
<div id="sendmessage" style="display:none">Your request has been sent. Thank you!</div> <div id="sendmessage" style="display:none">Your request has been sent. Thank you!</div>
<div id="errormessage" style="display:none">Error</div> <div id="errormessage" style="display:none">Error</div>
<form role="form" name="hubRequestForm" class="hubRequestForm" id="hubRequestForm" action="" method="post"> <form role="form" name="hubRequestForm" class="hubRequestForm" id="hubRequestForm" action="" method="post">
<input type="hidden" name="providercode" id="providercode" value="{{ .File.BaseFileName }}">
<input type="hidden" name="providername" id="providername" value="{{ .Title }}">
<div class="form-row"> <div class="form-row">
<div class="form-group col-lg-6"> <div class="form-group col-lg-6">
<input type="text" name="name" class="form-control" id="name" placeholder="Your Name" data-rule="minlen:4" data-msg="Please enter at least 4 characters" /> <input type="text" name="name" class="form-control" id="name" placeholder="Your Name" data-rule="minlen:4" data-msg="Please enter at least 4 characters" />
@ -48,7 +50,7 @@ var goal = "{{ .Site.Params.forms.hub.goal }}";
{{ if $projects }} {{ if $projects }}
<div class="form-group col-lg-6"> <div class="form-group col-lg-6">
What is your project? What is your project?
<select id="project" name="project"> <select id="projecttype" name="projecttype">
{{ range $projects }} {{ range $projects }}
<option value="{{ . }}">{{ . }}</option> <option value="{{ . }}">{{ . }}</option>
{{ end }} {{ end }}
@ -90,7 +92,7 @@ var goal = "{{ .Site.Params.forms.hub.goal }}";
{{ end }} {{ end }}
{{ $operatingsystems := .Param "operatingsystems" }} {{ $operatingsystems := .Param "operatingsystems" }}
{{ if $operatingsystems }} {{ if $operatingsystems }}
<div class="form-group col-lg-12"> <div class="form-group col-lg-6">
What Operating System would you like on your POWER resource? What Operating System would you like on your POWER resource?
<select id="operatingsystem" name="operatingsystem"> <select id="operatingsystem" name="operatingsystem">
{{ range $operatingsystems }} {{ range $operatingsystems }}
@ -99,6 +101,11 @@ var goal = "{{ .Site.Params.forms.hub.goal }}";
</select> </select>
</div> </div>
{{ end }} {{ end }}
<div class="form-group col-lg-6">
SSH Public Key File Upload : <input type="file" name="sshpubkeyupload" id="sshpubkeyupload" class="file" placeholder="Select your Public SSH Key File" onChange="getFileContents()" accept=".pub"><br>
<input type="hidden" name="sshpubkey" id="sshpubkey" value="">
<span class="comment">Please only add your public ssh key file (ending on <u>.pub</u>)</span>
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<textarea class="form-control" name="message" rows="5" data-rule="required" data-msg="Please write a short explanation about getting access. (Why, How, Whatfor, how long)" placeholder="Please write a short explanation about getting access. (Why, How, Whatfor, how long)"></textarea> <textarea class="form-control" name="message" rows="5" data-rule="required" data-msg="Please write a short explanation about getting access. (Why, How, Whatfor, how long)" placeholder="Please write a short explanation about getting access. (Why, How, Whatfor, how long)"></textarea>
@ -109,3 +116,14 @@ var goal = "{{ .Site.Params.forms.hub.goal }}";
</div></div> </div></div>
</div></div> </div></div>
</section> </section>
<script>
function getFileContents() {
const reader = new FileReader()
reader.onload = handleFileLoad;
reader.readAsText(event.target.files[0])
}
function handleFileLoad(event) {
document.getElementById('sshpubkey').value = event.target.result;
}
</script>


Loading…
Cancel
Save