-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathview.html.erb
More file actions
60 lines (52 loc) · 1.89 KB
/
Copy pathview.html.erb
File metadata and controls
60 lines (52 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<%
webaccess_url = "/secure-rnode/#{host}/#{port}/"
enabled_client = "web" # Supported values: web, native, both
auto_login = false # Set to true ONLY if the pam_tlpasswd module is installed (see authentication.md)
%>
<% if enabled_client == "web" || enabled_client == "both" %>
<button
type="button"
class="btn btn-primary"
onclick="connect_<%= job_id %>();">
<i class="fa fa-sign-in"></i>
Connect using the browser
</button>
<form id="loginForm_<%= job_id %>" method="post" action="<%= webaccess_url %>" target="_blank" style="display: none;">
<input type="hidden" name="username" value="<%= user %>">
<% if auto_login %>
<% pam_token = "#{job_id}:#{password}" %>
<input type="hidden" name="pamresponse" value="<%= pam_token %>"> <!-- pre 4.21.0 -->
<input type="hidden" name="password" value="<%= pam_token %>"> <!-- post 4.21.0 -->
<input type="hidden" name="loginsubmit" value="1">
<% end %>
</form>
<script type="text/javascript">
function connect_<%= job_id %>() {
const form = document.getElementById("loginForm_<%= job_id %>");
form.submit();
}
</script>
<% end %>
<% if enabled_client == "native" || enabled_client == "both" %>
<button
type="button"
class="btn btn-primary"
onclick="download_<%= job_id %>();">
<i class="fa fa-sign-in"></i>
Connect using the native client
</button>
<script type="text/javascript">
function download_<%= job_id %>() {
const oodConfigElement = document.getElementById("ood_config");
const rootPath = oodConfigElement.dataset.rootPath;
const fullPath = `${rootPath}files/fs<%= client_path %>`
const link = document.createElement('a');
link.href = fullPath;
link.download = `<%= job_id %>.tlclient`;
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
</script>
<% end %>