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