f4f: jfed identity re-added
[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 sfi_config" id="dl_sfi_config">
162                                                                         <span class="glyphicon glyphicon-download"></span> Download
163                                                                 </button>
164                                                 </td>
165                         </tr>
166                                                 <tr class="odd">
167                                                         {%if 'N/A' not in user_private_key%}
168                                                         <td class="key">Identity</td> 
169                                                 <td>
170                                                                 <button type="submit" name="dl_identity" class="btn btn-default btn-xs" title="You will require it to use jfed" id="dl_identity">
171                                                                 <span class="glyphicon glyphicon-download"></span> Download 
172                                                                 </button>
173                                                         </td>
174                                                         {%else%}
175                                                         <td class="key">Identity</td> 
176                                                         <td>
177                                                         <button type="submit" name="dl_identity" class="btn btn-default btn-xs disabled" title="You will require it to use jfed" id="dl_identity">
178                                                                 <span class="glyphicon glyphicon-download"></span> Download 
179                                                         </button>
180                                                         </td>
181                                                         {%endif%} 
182                                                 </tr>
183
184                                                 <tr class="even">
185                                                 <td colspan="2">
186                                                                 <p class="command">
187                                                                         <a href="#" style="color:green" data-toggle="modal" data-target="#tradeoffmodal">Automatic vs. Manual delegation of credentials:</a>
188                                                                         Trade-off between ease-of-use & security</p>
189                                                                 </p>
190                                                 </td>
191                                                 </tr>
192                                                 {%endif%}
193                                         </table>
194                         
195                 </div>
196         </div>
197
198         <div class="tab-pane row" id="account">
199                 <div class="col-md-12">
200         
201                 <h3>Principal Account <small>Account used for delegating credentials</small></h3>
202                 <table class="table"> 
203                         <tr class="odd"> 
204                         <th>Platform</th> 
205                         <th>Account Type</th>
206                                 <th>Account Delegation</th>
207                         <th>User hrn</th>
208                                 <th>User Status</th>
209                         <!--<th>Pub Key</th> -->
210                 </tr>   
211                         {% for row in principal_acc %}         
212                         <tr class="border_bottom">
213                         <td class="odd"> {{ row.platform_name }} </td>
214                         <td class="odd"> {{ row.account_type }} </td>
215                                 <td class="odd"> {{ row.delegation_type }} </td>
216                         <td class="odd"> {{ row.usr_hrn }}  </td>
217                                 <td class="odd"> {{ row.user_status }}  </td>
218                 <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
219                 </tr> 
220                         {%endfor%}               
221                 </table>
222         
223                 </div>
224         
225
226         {%if 'Enabled'  in user_status %}
227                 <div class="col-md-12">
228                 <h3>Credentials <small>Delegated to Principal Account</small></h3>
229                         <table class="table">
230                                         <caption><b>Delegated User Credential</b></caption> 
231                             <tr class="odd"> 
232                                 <th>Expiration Date</th>
233                                                 <th>Download</th>
234                             </tr>
235                                         {% for row in my_users %}         
236                                         <tr class="border_bottom">
237                                         <td class="odd"> {{ row.cred_exp }} </td>
238                                                 <td class="odd">
239                                                         <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
240                                                                 <span class="glyphicon glyphicon-download"></span> Credential
241                                                         </button>
242                                                         <button class="btn btn-default btn-xs" name= "dl_user_cert" type="submit" title="Download User Certificate">
243                                                                 <span class="glyphicon glyphicon-download"></span> Certificate
244                                                         </button>
245                              <button class="btn btn-default btn-xs" name= "dl_user_p12" type="submit" title="Download User PKCS12">
246                                  <span class="glyphicon glyphicon-download"></span> PKCS p12
247                              </button>
248                                                 </td>
249                                         </tr>
250                                         {%endfor%}
251                                  </table>
252                                 <p></p>
253                                 <table class="mytable table table-bordered table-hover">
254                                         <caption><b>Delegated Slice Credentials</b></caption>  
255                                 <tr class="odd"> 
256                                                 <th>Slice Name</th> 
257                                         <th>Expiration Date</th>
258                                                 <th>Download</th>
259                                 </tr>
260                                         {% for row in my_slices %}     
261                                 <tr class="border_bottom">
262                                         <td class="odd"> {{ row.slice_name }} </td>
263                                                 <td class="odd"> {{ row.cred_exp }} </td>
264                                                 <td class="odd"> 
265                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
266                                                                 <span class="glyphicon glyphicon-download"></span> Download
267                                                         </button> 
268                                                 </td>
269                                 </tr>
270                                 {%endfor%}
271                                 </table>
272                                 <p></p>
273                                 <table class="mytable table table-bordered table-hover">
274                                         <caption><b>Delegated Authority Credentials</b></caption>
275                                         <tr class="odd"> 
276                                         <th>Authority Name</th> 
277                                         <th>Expiration Date</th>
278                                                 <th>Download</th>
279                                         </tr>
280                                         {% for row in my_auths %}
281                                         <tr class="border_bottom">
282                                         <td class="odd"> {{ row.auth_name }} </td>
283                                         <td class="odd"> {{ row.cred_exp }} </td>
284                                                 <td class="odd">
285                                                         <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
286                                                                 <span class="glyphicon glyphicon-download"></span> Download
287                                                         </button>
288                                                 </td>
289                                         </tr>
290                                         {%endfor%}
291                                 </table>
292                                 <p></p>
293                                  {%if '' not in my_users%}      
294                                 <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
295                                 {%else%}
296                                 <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
297                                 {%endif%}
298                 </div>
299         </div>
300 <!-- Modal- No credentials -->
301 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
302             <div class="modal-dialog">
303                 <div class="modal-content">
304                     <div class="modal-header">
305                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
306                             <h4 class="modal-title" id="myModalLabel">No credentials are delegated to the portal</h4>
307                     </div>
308                                         <div class="modal-body" style="text-align:justify;">
309                                         <p>You are getting this message for any of the following reasons:</p>
310                                         <ul>
311                                                 <li>If your account is still pending for validation</li>
312                                                 <li>If you press the "Clear Credentials" button</li>
313                                                 <li>If you "Generate a new key pair"</li>
314                                                 <li>If a new slice is added to your account</li>
315                                         </ul>
316                                         <p>Unless your account has not yet been validated, it is sufficient to refresh the page or go back to the home page. 
317                                                 The portal will then regenerate your credentials. In some cases it may take more time than usual. If nothing works, 
318                                                 then please logout and login back into to the portal.
319                                         </p>
320                                         <h3>Manual delegation of credentials</h3>
321                                                 <p>
322                                                         You have selected upon sign-up to upload your public key. As you have uploaded your own public key, 
323                                                         the portal can no longer generate your credentials automatically. In order to have your credentials 
324                                                         delegated to the portal, please follow these instructions:
325                                                 </p>
326                                                 <ul>
327                                                         <li>Your account must first be validated by the manager of your organization.</li>
328                                                         <li>In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to
329                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a></li>
330                                                 </ul>
331                                         </p>
332                                         <h3>Contact support</h3>
333                                         <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>
334                     </div>
335                     <div class="modal-footer">
336                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
337                     </div>
338                 </div>
339             </div>
340 </div>
341
342
343 <!-- Modal- Trade-off Message  -->
344 <div class="modal fade" id="tradeoffmodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
345             <div class="modal-dialog">
346                 <div class="modal-content">
347                     <div class="modal-header">
348                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
349                             <h4 class="modal-title" id="myModalLabel">
350                                                                 Automatic vs. Manual delegation of credentials
351                                                         </h4>
352                     </div>
353                                         <div class="modal-body" style="text-align:justify;">
354                                         <h3>Automatic delegation of credentials</h3>
355                                                 <p>Don't delete private key, ease-of-use option:</p>
356                                                 <ul>
357                                                         <li>
358                                                                 This means that you will keep your private key in the portal and it will automatically delegate your credentials on your behalf.
359                                                         </li>
360                                                         <li>
361                                                                 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 
362                                                                 will be available to you and the OneLab admins only.
363                                                         </li>
364                                                 </ul>
365                                         <h3>Manual delegation of credentials</h3>
366                                                 <p>Download & Delete private key, higher security option:</p>
367                                                 <ul>
368                                                         <li>If you delete your private key, you will have more security but the portal will no longer be able to delegate credentials 
369                                                                 on your behalf, and you will have to manually
370                                                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
371                                                         </li>
372                                                 </ul>
373                                         <h3>Contact support</h3>
374                                         <p>For more information, please  <a href="/contact/" target="_blank">contact us</a>.</p>
375                     </div>
376                     <div class="modal-footer">
377                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
378                     </div>
379                 </div>
380             </div>
381 </div>
382
383
384
385         <div class="tab-pane row" id="access">
386                 <div class="col-md-12">
387         
388                 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
389         <table class="mytable table table-bordered table-hover"> 
390             <tr class="odd"> 
391                 <th>Platform</th> 
392                 <th>Account Type</th>
393                                 <th>Reference to</th>
394                                 <th>Remove Account</th>
395             </tr>   
396             {% for row in ref_acc %}         
397             <tr class="border_bottom">
398                 <td class="odd"> {{ row.platform_name }} </td>
399                 <td class="odd"> {{ row.account_type }} </td>
400                                 <td class="odd"> {{ row.account_reference }} </td>
401                                 <td class="odd">
402                                 <button class="btn btn-danger" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
403                                                 <span class="glyphicon glyphicon-minus"></span>
404                                         </button>
405                                 </td>
406             </tr> 
407             {%endfor%}               
408         </table>                
409                 
410                 
411                 <h3>Add reference account to the following testbeds</h3>
412         <table class="mytable table table-bordered table-hover"> 
413             <tr class="odd"> 
414                 <th>Platforms</th> 
415                 <th>Add Account</th>
416             </tr>   
417             {% for platform in platform_list %}         
418             <tr class="border_bottom">
419                 <td class="odd"> {{ platform.platform_no_access }} </td>
420                 <td class="odd">
421                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
422                                                 <span class="glyphicon glyphicon-plus"></span>
423                                         </button>
424                                 </td>
425             </tr> 
426             {%endfor%}               
427         </table>
428         </div>
429 {%endif%} 
430 </div>
431 </form>
432 </div>
433
434 <script>
435     $(document).ready(function() {
436         $('.nav-tabs a').click(function (e) {
437                         e.preventDefault();
438                         $(this).tab('show');
439                         id = $(this).attr('href').substr(1);
440                 
441                 });
442                 
443         $('button#createslice').click(function() {
444             window.location="/portal/slice_request/";
445         });
446     });
447 </script>
448
449 {% endblock %}