3193: use sshkey gem to validate the ssh key passed in.
[arvados.git] / apps / workbench / app / views / users / _manage_ssh_keys.html.erb
1 <div>
2   <% if !@my_ssh_keys.any? %>
3      <p> You have not yet set up an SSH public key for use with Arvados. </p>
4      <p>  <%= link_to "Click here to learn about SSH keys in Arvados.",
5                   "#{Rails.configuration.arvados_docsite}/user/getting_started/ssh-access-unix.html", 
6                   style: "font-weight: bold",
7                   target: "_blank" %>       </p>
8      <p> When you have an SSH key you would like to use, add it using the <b>Add</b> button. </p>
9   <% end %>
10
11   <% if @my_ssh_keys.andand.any? %>
12     <table class="table manage-ssh-keys-table">
13       <colgroup>
14         <col style="width: 45%" />
15         <col style="width: 45%" />
16         <col style="width: 10%" />
17       </colgroup>
18       <thead>
19         <tr>
20           <th> Name </th>
21           <th> Key Finger Print </th>
22           <th> </th>
23         </tr>
24       </thead>
25       <tbody>
26         <% @my_ssh_keys.andand.each do |key| %>
27           <tr style="word-break:break-all;">
28             <td>
29               <%= key[:name] %>
30             </td>
31             <td style="word-break:break-all;">
32               <% if key[:public_key] && key[:public_key].size > 0 %>
33                 <div>
34                   <%= SSHKey.fingerprint key[:public_key] %>
35                 </div>
36               <% else %>
37                   <%= key[:public_key] %>
38               <% end %>
39             </td>
40             <td>
41               <%= link_to(authorized_key_path(id: key[:uuid]), method: 'delete', class: 'btn btn-sm', data: {confirm: "Really delete key?"}) do %>
42                   <i class="fa fa-fw fa-trash-o"></i>
43               <% end %>
44             </td>
45           </tr>
46         <% end %>
47       </tbody>
48     </table>
49   <% end %>
50 </div>