-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.html.erb
27 lines (26 loc) · 1.02 KB
/
view.html.erb
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
<script type="text/javascript">
(function () {
let date = new Date();
date.setTime(date.getTime() + (7*24*60*60*1000));
let expires = "expires=" + date.toUTCString();
let cookiePath = "path=/rnode/" + "<%= host.to_s %>" + "/" + "<%= port.to_s %>/";
/**
rstuido wants a cookie called csrf-token - but that's going to change in 2020!
*/
/**
^- ???????????
*/
let cookie = `csrf-token=<%= csrf_token %>;${expires};${cookiePath};SameSite=strict;secure`;
document.cookie = cookie;
})();
</script>
<form action="/rnode/<%= host %>/<%= port %>/auth-do-sign-in" method="post" target="_blank">
<input type="hidden" name="csrf-token" value="<%= csrf_token %>"/>
<input type="hidden" name="username" value="<%= ENV["USER"] %>">
<input type="hidden" name="password" value="<%= password %>">
<input type="hidden" name="staySignedIn" value="1">
<input type="hidden" name="appUri" value="">
<button class="btn btn-primary" type="submit">
<i class="fa fa-registered"></i> Connect to RStudio Server
</button>
</form>