f4f: template migration from onelab to f4f
[myslice.git] / portal / templates / fed4fire / fed4fire_account-view.html
1 {% extends "layout.html" %}
2 {% block content %}
3
4 <div class="row">
5         <div class="col-md-12">
6                  <div class="breadcrumbs">
7                          Account &nbsp;>&nbsp; <a href="/account">{{ person.email }}</a>
8                  </div>
9         </div>
10          {%if 'no_creds'  in user_cred %}
11     <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">NO CREDENTIALS</a> are delegated to the portal!</p>
12     {%endif%}
13          {%if 'creds_expired'  in user_cred %}
14     <p class="command"><a href="#" style="color:red" data-toggle="modal" data-target="#myModal">EXPIRED CREDENTIALS</a> Please delegate again your credentials to the portal!</p>
15     {%endif%}
16
17 </div>
18 {% if messages %}
19 <ul class="messages">
20     {% for message in messages %}
21     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
22     {% endfor %}
23 </ul>
24 {% endif %}
25 <div class="row">
26         <div class="col-md-12">
27                 <ul class="nav nav-tabs nav-section">
28                         <li class="active"><a href="#profile">User Profile</a></li>
29                         <li><a href="#account">Account</a></li>
30                         <li><a href="#access">Testbed Access</a></li>
31                 </ul>
32     </div>
33 </div>
34 <div class="tab-content">
35         <div class="tab-pane active row" id="profile">
36                 
37                 <div class="col-md-12">
38
39                         <form id="editForm" method="post" action="account_process" enctype="multipart/form-data">
40                                 {% csrf_token %}
41                                         <table class="profile">          
42                                         <tr>
43                                                 <td colspan="2">
44                                                                 <div><h3>Platform: Myslice</h3></div>
45                                                 </td>
46                                         </tr>
47                                         <tr>
48                                                 <td class="key">Email</td>
49                                                 <td class="value">
50                                                                 <span id="emailval" class="value" >{{ person.email }}</span>
51                                                                 <button class="btn btn-default" type="button" id="edit_email" onclick="editAlert();"  title="To change your affiliation please contact the administrator">
52                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
53                                                                 </button>
54                                                         </td>
55                                         </tr>
56                                         <tr class="odd">
57                                                         <td class="key">Password</td>
58                                                         <td class="value"> 
59                                                                 <button class="btn btn-default btn-xs" type="button" title="Password" name="edit_pass" id="edit_pass">
60                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
61                                                                 </button>
62                                                                 <span id="passval"class="value">******** </span>
63                                                                 <span class="hide_this" id="span_pass">
64                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_pass_change"> Cancel </button>
65                                                                 <div style='display:none;' id="pass_form">
66                                                                 <input type='hidden'  value='' /></div>
67                                                                 <table id="edit_password">
68                                                                         <tr>
69                                                                                         <td>Enter password: </td>
70                                                                                         <td class="field"> <input type="password" name="password" id="password" /> </td>
71                                                                                 </tr>
72                                                                                 <tr>
73                                                                                         <td>Confirm password: </td>
74                                                                                         <td class="field"> 
75                                                                                                 <input type="password" name="confirmpassword" id="confirmpassword" /> 
76                                                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_pass" value="Save"/> 
77                                                                                         </td>
78                                                                         </tr>
79                                                                 </table>
80                                                                 </span> 
81                                                         </td>
82                                         </tr>
83                                         <tr class="even">
84                                                         <td class="key">Full Name</td>
85                                                         <td class="value">
86                                                                 <span id="nameval" class="value" >{{ fullname }} </span>
87                                                                 <span class="hide_this" id="span_name">
88                                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
89                                                                 <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
90                                                                 <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
91                                                                 <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
92                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
93                                                                 </span>
94                                                                 <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
95                                                                         <span class="glyphicon glyphicon-edit"></span> Edit
96                                                                 </button>
97                                                         </td>
98                                         </tr>
99                                         <tr class="odd">
100                                                         <td class="key">Authority</td>
101                                                         <td class="value">
102                                                                 <span id="affval" class="value">{{ authority }}</span>
103                                                                  <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="editAlert()"  title="To change your authority please contact the administrator">
104                                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
105                                                                  </button>
106                                                         </td>
107                                                 </tr>
108                                                 {%if 'Enabled'  in user_status %}
109                                                 <tr class="even">
110                                                         <td class="key">Generate Keys</td>
111                                                         <td>
112                                                                 <input type="submit" name="generate" class="btn btn-primary" value="Generate a new Key Pair" id="generate_keypair" 
113                                                                            onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
114                                                                            title="It will generate a new key Pair and your current credentials will be overwritten."/>
115                                                 </td> 
116                                         </tr>
117                                         <tr class="odd">
118                                                 <td class="key">Public Key</td>
119                                                 <td class="value">
120                                                                 <span id="keyval" class="value">******** </span>
121                                                                 <span class="hide_this" id="span_upload">
122                                                                         <button type="button" class="btn btn-default" title="Cancel" id="cancel_upload"> Cancel </button>
123                                                                         <div style='display:none;'>
124                                                                                 <input type='hidden'  name='upload'  /></div>
125                                                                                 <input type="file" name="pubkey" class="required" id="pubkey"/>  
126                                                                                 <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
127                                                                                    onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
128                                                                 </span>
129                                                                 <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
130                                                                 <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
131                                                                         <span class="glyphicon glyphicon-download"></span> Download
132                                                                 </button>
133                                                                 <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
134                                                                         <span class="glyphicon glyphicon-upload"></span> Upload
135                                                                 </button>       
136                                                 </td>
137                                         </tr>
138                                         <tr class="even" id="pkey_row">
139                                                  {%if 'N/A' not in user_private_key%}
140                                                 <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
141                                                 <td class="value">********<a href="#"></a>
142                                                         <button type="submit" name="dl_pkey" class="btn btn-default" title="Download your privaye key" id="dl_pkey">
143                                                                         <span class="glyphicon glyphicon-download"></span> Download     
144                                                                 </button>
145                                                         <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
146                                                                                 onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
147                                                 </td>
148                                                   {%else%}
149                                                         <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
150                                                         <td class="value">********<a href="#"></a>
151                                                         <button type="submit" name="dl_pkey" class="btn btn-default disabled" title="Download your privaye key" id="dl_pkey">
152                                                                 <span class="glyphicon glyphicon-download"></span> Download 
153                                                         </button>
154                                                         <input class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key" value="Delete" />
155                                                         </td>
156                                                  {%endif%}              
157                                                 </tr>
158                                         <tr class="even" id="sfi_config_row">
159                                                 <td class="key">sfi_config </td>
160                                                 <td class="value">use sfi_config file with sfi.py package (pip install sfa)<a href="#"></a>
161                                                         <button type="submit" name="dl_sfi_config" class="btn btn-default btn-xs" title="Download your privaye key" id="dl_sfi_config">
162                                                                         <span class="glyphicon glyphicon-download"></span> Download
163                                                                 </button>
164                                                 </td>
165                         </tr>
166
167                                                 <tr class="even">
168                                                 <td colspan="2">
169                                                                 <p class="command">
170                                                                         <a href="#" style="color:green" data-toggle="modal" data-target="#tradeoffmodal">Automatic vs. Manual delegation of credentials:</a>
171                                                                         Trade-off between ease-of-use & security</p>
172                                                                 </p>
173                                                 </td>
174                                                 </tr>
175                                                 {%endif%}
176                                         </table>
177                         
178                 </div>
179         </div>
180
181         <div class="tab-pane row" id="account">
182                 <div class="col-md-12">
183         
184                 <h3>Principal Account <small>Account used for delegating credentials</small></h3>
185                 <table class="table"> 
186                         <tr class="odd"> 
187                         <th>Platform</th> 
188                         <th>Account Type</th>
189                                 <th>Account Delegation</th>
190                         <th>User hrn</th>
191                                 <th>User Status</th>
192                         <!--<th>Pub Key</th> -->
193                 </tr>   
194                         {% for row in principal_acc %}         
195                         <tr class="border_bottom">
196                         <td class="odd"> {{ row.platform_name }} </td>
197                         <td class="odd"> {{ row.account_type }} </td>
198                                 <td class="odd"> {{ row.delegation_type }} </td>
199                         <td class="odd"> {{ row.usr_hrn }}  </td>
200                                 <td class="odd"> {{ row.user_status }}  </td>
201                 <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
202                 </tr> 
203                         {%endfor%}               
204                 </table>
205         
206                 </div>
207         
208
209         {%if 'Enabled'  in user_status %}
210                 <div class="col-md-12">
211                 <h3>Credentials <small>Delegated to Principal Account</small></h3>
212                         <table class="table">
213                                         <caption><b>Delegated User Credential</b></caption> 
214                             <tr class="odd"> 
215                                 <th>Expiration Date</th>
216                                                 <th>Download</th>
217                             </tr>
218                                         {% for row in my_users %}         
219                                         <tr class="border_bottom">
220                                         <td class="odd"> {{ row.cred_exp }} </td>
221                                                 <td class="odd">
222                                                         <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
223                                                                 <span class="glyphicon glyphicon-download"></span> Credential
224                                                         </button>
225                                                         <button class="btn btn-default btn-xs" name= "dl_user_cert" type="submit" title="Download User Certificate">
226                                                                 <span class="glyphicon glyphicon-download"></span> Certificate
227                                                         </button>
228                              <button class="btn btn-default btn-xs" name= "dl_user_p12" type="submit" title="Download User PKCS12">
229                                  <span class="glyphicon glyphicon-download"></span> PKCS p12
230                              </button>
231                                                 </td>
232                                         </tr>
233                                         {%endfor%}
234                                  </table>
235                                 <p></p>
236                                 <table class="mytable table table-bordered table-hover">
237                                         <caption><b>Delegated Slice Credentials</b></caption>  
238                                 <tr class="odd"> 
239                                                 <th>Slice Name</th> 
240                                         <th>Expiration Date</th>
241                                                 <th>Download</th>
242                                 </tr>
243                                         {% for row in my_slices %}     
244                                 <tr class="border_bottom">
245                                         <td class="odd"> {{ row.slice_name }} </td>
246                                                 <td class="odd"> {{ row.cred_exp }} </td>
247                                                 <td class="odd"> 
248                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
249                                                                 <span class="glyphicon glyphicon-download"></span> Download
250                                                         </button> 
251                                                 </td>
252                                 </tr>
253                                 {%endfor%}
254                                 </table>
255                                 <p></p>
256                                 <table class="mytable table table-bordered table-hover">
257                                         <caption><b>Delegated Authority Credentials</b></caption>
258                                         <tr class="odd"> 
259                                         <th>Authority Name</th> 
260                                         <th>Expiration Date</th>
261                                                 <th>Download</th>
262                                         </tr>
263                                         {% for row in my_auths %}
264                                         <tr class="border_bottom">
265                                         <td class="odd"> {{ row.auth_name }} </td>
266                                         <td class="odd"> {{ row.cred_exp }} </td>
267                                                 <td class="odd">
268                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
269                                                                 <span class="glyphicon glyphicon-download"></span> Download
270                                                         </button>
271                                                 </td>
272                                         </tr>
273                                         {%endfor%}
274                                 </table>
275                                 <p></p>
276                                  {%if '' not in my_users%}      
277                                 <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
278                                 {%else%}
279                                 <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
280                                 {%endif%}
281                 </div>
282         </div>
283 <!-- Modal- No credentials -->
284 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
285             <div class="modal-dialog">
286                 <div class="modal-content">
287                     <div class="modal-header">
288                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
289                             <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
290                     </div>
291                                         <div class="modal-body" style="text-align:justify;">
292                                         <p>You are getting this message for any of the following reasons:</p>
293                                         <ul>
294                                                 <li>If your account is still pending for validation</li>
295                                                 <li>If you press the "Clear Credentials" button</li>
296                                                 <li>If you "Generate a new key pair"</li>
297                                                 <li>If a new slice is added to your account</li>
298                                         </ul>
299                                         <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
300                                                 The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
301                                                 then please logout and login back into to the portal.
302                                         </p>
303                                         <h3>Manual delegation of credentials</h3>
304                                                 <p>
305                                                         You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
306                                                         the portal can no longer generate your credentials automatically. In order to have your credentials 
307                                                         delegated to the portal, please follow these instructions:
308                                                 </p>
309                                                 <ul>
310                                                         <li>Your account must first be validated by the manager of your organization.</li>
311                                                         <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
312                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
313                                                 </ul>
314                                         </p>
315                                         <h3>Contact support</h3>
316                                         <p>If you don't have the above mentioned cases and still have this message, please  <a href="/contact/" target="_blank">contact us</a>.</p>
317                     </div>
318                     <div class="modal-footer">
319                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
320                     </div>
321                 </div>
322             </div>
323 </div>
324
325
326 <!-- Modal- Trade-off Message  -->
327 <div class="modal fade" id="tradeoffmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
328             <div class="modal-dialog">
329                 <div class="modal-content">
330                     <div class="modal-header">
331                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
332                             <h4 class="modal-title" id="myModalLabel">
333                                                                 Automatic vs. Manual delegation of credentials
334                                                         </h4>
335                     </div>
336                                         <div class="modal-body" style="text-align:justify;">
337                                         <h3>Automatic delegation of credentials</h3>
338                                                 <p>Don't delete private key, ease-of-use option:</p>
339                                                 <ul>
340                                                         <li>
341                                                                 This means that you will keep your private key in the portal and it will automatically delegate your credentials on your behalf.
342                                                         </li>
343                                                         <li>
344                                                                 This option does not provide as high of a level of security; however, your private key will still only be used in the portal and 
345                                                                 will be available to you and the OneLab admins only.
346                                                         </li>
347                                                 </ul>
348                                         <h3>Manual delegation of credentials</h3>
349                                                 <p>Download & Delete private key, higher security option:</p>
350                                                 <ul>
351                                                         <li>If you delete your private key, you will have more security but the portal will no longer be able to delegate credentials 
352                                                                 on your behalf, and you will have to manually
353                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
354                                                         </li>
355                                                 </ul>
356                                         <h3>Contact support</h3>
357                                         <p>For more information, please  <a href="/contact/" target="_blank">contact us</a>.</p>
358                     </div>
359                     <div class="modal-footer">
360                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
361                     </div>
362                 </div>
363             </div>
364 </div>
365
366
367
368         <div class="tab-pane row" id="access">
369                 <div class="col-md-12">
370         
371                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
372         <table class="mytable table table-bordered table-hover"> 
373             <tr class="odd"> 
374                 <th>Platform</th> 
375                 <th>Account Type</th>
376                                 <th>Reference to</th>
377                                 <th>Remove Account</th>
378             </tr>   
379             {% for row in ref_acc %}         
380             <tr class="border_bottom">
381                 <td class="odd"> {{ row.platform_name }} </td>
382                 <td class="odd"> {{ row.account_type }} </td>
383                                 <td class="odd"> {{ row.account_reference }} </td>
384                                 <td class="odd">
385                                 <button class="btn btn-danger" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
386                                                 <span class="glyphicon glyphicon-minus"></span>
387                                         </button>
388                                 </td>
389             </tr> 
390             {%endfor%}               
391         </table>                
392                 
393                 
394                 <h3>Add reference account to the following testbeds</h3>
395         <table class="mytable table table-bordered table-hover"> 
396             <tr class="odd"> 
397                 <th>Platforms</th> 
398                 <th>Add Account</th>
399             </tr>   
400             {% for platform in platform_list %}         
401             <tr class="border_bottom">
402                 <td class="odd"> {{ platform.platform_no_access }} </td>
403                 <td class="odd">
404                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
405                                                 <span class="glyphicon glyphicon-plus"></span>
406                                         </button>
407                                 </td>
408             </tr> 
409             {%endfor%}               
410         </table>
411         </div>
412 {%endif%} 
413 </div>
414 </form>
415 </div>
416
417 <script>
418     $(document).ready(function() {
419         $('.nav-tabs a').click(function (e) {
420                         e.preventDefault();
421                         $(this).tab('show');
422                         id = $(this).attr('href').substr(1);
423                 
424                 });
425                 
426         $('button#createslice').click(function() {
427             window.location="/portal/slice_request/";
428         });
429     });
430 </script>
431
432 {% endblock %}