layout changes
[myslice.git] / portal / templates / account-view.html
1 {% extends "layout-unfold1.html" %}
2 {% block unfold_main %}
3
4
5 {% if messages %}
6 <ul class="messages">
7     {% for message in messages %}
8     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
9     {% endfor %}
10 </ul>
11 {% endif %}
12
13 <div class="wrapper" id="institution">
14     <ul class="nav nav-tabs">
15       <li class="active"><a class="home-tab" data-panel="user_profile" href="#">User Profile</a></li>
16       <li><a class="home-tab" data-panel="principal_acc" href="#">User Account</a></li>
17       <li><a class="home-tab" data-panel="ref_acc" href="#">Testbed Access</a></li>
18     </ul>
19 <div class="home-panel" id="user_profile">
20 <p></p>
21 <form id="editForm"  method="POST" action="account_process" enctype="multipart/form-data">
22 <div id="middle" align="center">
23         <div class="well">
24                 {% csrf_token %}
25                         <table class="profile">          
26                         <tr class="odd">
27                                 <td colspan="2">
28                                                 <div id="info">Platform: Myslice</div>
29                                 </td>
30                         </tr>
31                         <tr class="even">
32                                 <td class="key">Email</td>
33                                 <td class="value">
34                                                 <span id="emailval" class="value" >{{ person.email }}</span>
35                                                 <button class="btn btn-default btn-xs" type="button" id="edit_email" onclick="editAlert()"  title="To change your affiliation please contact the administrator">
36                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
37                                                 </button>
38                                         </td>
39                         </tr>
40                         <tr class="odd">
41                                         <td class="key">Password</td>
42                                         <td class="value"> 
43                                                 <button class="btn btn-default btn-xs" type="button" title="Password" name="edit_pass" id="edit_pass">
44                                                         <span class="glyphicon glyphicon-edit"></span> Edit
45                                                 </button>
46                                                 <span id="passval"class="value">******** </span>
47                                                 <span class="hide_this" id="span_pass">
48                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_pass_change"> Cancel </button>
49                                                 <div style='display:none;' id="pass_form">
50                                                 <input type='hidden'  value='' /></div>
51                                                 <table id="edit_password">
52                                                         <tr>
53                                                                         <td>Enter password: </td>
54                                                                         <td class="field"> <input type="password" name="password" id="password" /> </td>
55                                                                 </tr>
56                                                                 <tr>
57                                                                         <td>Confirm password: </td>
58                                                                         <td class="field"> 
59                                                                                 <input type="password" name="confirmpassword" id="confirmpassword" /> 
60                                                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_pass" value="Save"/> 
61                                                                         </td>
62                                                         </tr>
63                                                 </table>
64                                                 </span> 
65                                         </td>
66                         </tr>
67                         <tr class="even">
68                                         <td class="key">Full Name</td>
69                                         <td class="value">
70                                                 <span id="nameval" class="value" >{{ fullname }} </span>
71                                                 <span class="hide_this" id="span_name">
72                                                 <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_name_change"> Cancel </button> 
73                                                 <div style='display:none;'><input type='hidden'  name='nameform'  /></div>
74                                                 <input id="fname" type="text" name="fname" class="required"  maxlength="200" value="{{firstname}}" />
75                                                 <input id="lname" type="text" name="lname" class="required"  maxlength="200" value="{{lastname}}" />
76                                                 <input type="submit" class="btn btn-default btn-xs" name="submit_name" value="Save"/>
77                                                 </span>
78                                                 <button class="btn btn-default btn-xs" type="button"title="Full Name" id="edit_name">
79                                                         <span class="glyphicon glyphicon-edit"></span> Edit
80                                                 </button>
81                                         </td>
82                         </tr>
83                         <tr class="odd">
84                                         <td class="key">Authority</td>
85                                         <td class="value">
86                                                 <span id="affval" class="value">{{ authority }}</span>
87                                                  <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="editAlert()"  title="To change your authority please contact the administrator">
88                                                 <span class="glyphicon glyphicon-question-sign"></span> Edit
89                                                  </button>
90                                         </td>
91                                 </tr>
92                                 {%if 'Enabled'  in user_status %}
93                                 <tr class="even">
94                                         <td class="key">Generate Keys</td>
95                                         <td>
96                                                 <input type="submit" name="generate" class="btn btn-danger btn-xs" value="Generate a new Key Pair" id="generate_keypair" 
97                                                            onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
98                                                            title="It will generate a new key Pair and your current credentials will be overwritten."/>
99                                 </td> 
100                         </tr>
101                         <tr class="odd">
102                                 <td class="key">Public Key</td>
103                                 <td class="value">
104                                                 <span id="keyval" class="value">******** </span>
105                                                 <span class="hide_this" id="span_upload">
106                                                         <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_upload"> Cancel </button>
107                                                         <div style='display:none;'>
108                                                                 <input type='hidden'  name='upload'  /></div>
109                                                                 <input type="file" name="pubkey" class="required" id="pubkey"/>  
110                                                                 <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
111                                                                    onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
112                                                 </span>
113                                                 <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
114                                                 <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
115                                                         <span class="glyphicon glyphicon-download"></span> Download
116                                                 </button>
117                                                 <button class="btn btn-default btn-xs" id="upload_file" type="button" title="Upload a public key">
118                                                         <span class="glyphicon glyphicon-upload"></span> Upload
119                                                 </button>       
120                                 </td>
121                         </tr>
122                         <tr class="even" id="pkey_row">
123                                  {%if 'N/A' not in user_private_key%}
124                                 <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
125                                 <td class="value">********<a href="#">
126                                         <button type="submit" name="dl_pkey" class="btn btn-default btn-xs" title="Download your privaye key" id="dl_pkey">
127                                                         <span class="glyphicon glyphicon-download"></span> Download     
128                                                 </button>
129                                         <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
130                                                                 onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
131                                 </td>
132                                   {%else%}
133                                         <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
134                                         <td class="value">********<a href="#">
135                                         <button type="submit" name="dl_pkey" class="btn btn-default btn-xs disabled" 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 disabled" id="delete" name="delete" type="submit" title="Delete your private key"
139                                                                 value="Delete"  />
140                                         </td>
141                                  {%endif%}              
142                                 </tr>
143                                 <tr class="odd">
144                                 <td colspan="2">
145                                         <p class="message" id="pkey_del_msg"><b> Tradeoff:</b> Ease-of-use vs Security.<br>
146                                                         <b>Ease-of-use:</b> Automatic account delegation. Don't delete private key.<br>
147                                                         <b>Security:</b> Manual account delegation. Download & Delete private key.
148                                                 </p>
149                                 </td>
150                                 </tr>
151                                 {%endif%}
152                         </table>
153         </div>
154 </div>
155 </div>
156
157 <div class="home-panel" id="principal_acc" style="display:none;">
158
159 <h3>Principal Account <small>Account used for delegating credentials</small></h3>
160 <div id="middle" align="center">
161         <div class="well">
162                 <table class="table table-bordered table-hover  mytable"> 
163                         <tr class="odd"> 
164                         <th>Platform</th> 
165                         <th>Account Type</th>
166                                 <th>Account Delegation</th>
167                         <th>User hrn</th>
168                                 <th>User Status</th>
169                         <!--<th>Pub Key</th> -->
170                 </tr>   
171                         {% for row in principal_acc %}         
172                         <tr class="border_bottom">
173                         <td class="odd"> {{ row.platform_name }} </td>
174                         <td class="odd"> {{ row.account_type }} </td>
175                                 <td class="odd"> {{ row.delegation_type }} </td>
176                         <td class="odd"> {{ row.usr_hrn }}  </td>
177                                 <td class="odd"> {{ row.user_status }}  </td>
178                 <!--    <td class="even"> {{ row.usr_pubkey }} </td> -->
179                 </tr> 
180                         {%endfor%}               
181                 </table>
182         </div>
183 </div>
184
185
186
187 {%if 'Enabled'  in user_status %}
188 <h3>Credentials <small>Delegated to Principal Account</small></h3>
189 <div id="middle" align="center">
190     <div class="well">
191         <table class="mytable table table-bordered table-hover">
192                         <caption><b>Delegated User Credential</b></caption> 
193             <tr class="odd"> 
194                 <th>Expiration Date</th>
195                                 <th>Download</th>
196             </tr>
197                         {% for row in my_users %}         
198                         <tr class="border_bottom">
199                         <td class="odd"> {{ row.cred_exp }} </td>
200                                 <td class="odd">
201                                         <button class="btn btn-default btn-xs" name= "dl_user_cred" type="submit" title="Download User Credential">
202                                                 <span class="glyphicon glyphicon-download"></span> Download
203                                         </button>
204                                 </td>
205                         </tr>
206                         {%endfor%}
207                  </table>
208                 <p></p>
209                 <table class="mytable table table-bordered table-hover">
210                         <caption><b>Delegated Slice Credentials</b></caption>  
211                 <tr class="odd"> 
212                                 <th>Slice Name</th> 
213                         <th>Expiration Date</th>
214                                 <th>Download</th>
215                 </tr>
216                         {% for row in my_slices %}     
217                 <tr class="border_bottom">
218                         <td class="odd"> {{ row.slice_name }} </td>
219                                 <td class="odd"> {{ row.cred_exp }} </td>
220                                 <td class="odd"> 
221                                         <button class="btn btn-default btn-xs" name= "dl_{{row.slice_name}}" type="submit" title="Download Slice Credentials">
222                                                 <span class="glyphicon glyphicon-download"></span> Download
223                                         </button> 
224                                 </td>
225                 </tr>
226                 {%endfor%}
227                 </table>
228                 <p></p>
229                 <table class="mytable table table-bordered table-hover">
230                         <caption><b>Delegated Authority Credentials</b></caption>
231                         <tr class="odd"> 
232                         <th>Authority Name</th> 
233                         <th>Expiration Date</th>
234                                 <th>Download</th>
235                         </tr>
236                         {% for row in my_auths %}
237                         <tr class="border_bottom">
238                         <td class="odd"> {{ row.auth_name }} </td>
239                         <td class="odd"> {{ row.cred_exp }} </td>
240                                 <td class="odd">
241                                         <button class="btn btn-default btn-xs" name= "dl_{{row.auth_name}}" type="submit" title="Download Authority Credentials">
242                                                 <span class="glyphicon glyphicon-download"></span> Download
243                                         </button>
244                                 </td>
245                         </tr>
246                         {%endfor%}
247                 </table>
248                 <p></p>
249                  {%if '' not in my_users%}      
250                 <p><button class="btn btn-danger btn-lg btn-block"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
251                 {%else%}
252                 <p><button class="btn btn-danger btn-lg btn-block disabled"   name= "clear_cred" type="submit" title="Clear All Credentials">Clear Credentials</button></p>
253                 {%endif%}
254     </div>
255 </div>
256 </div>
257
258
259 <div class="home-panel" id="ref_acc" style="display:none;">
260 <h3>Testbed Access <small>Reference Accounts in the following testbeds</small></h3>
261 <div id="middle" align="center">
262     <div class="well">
263         <table class="mytable table table-bordered table-hover"> 
264             <tr class="odd"> 
265                 <th>Platform</th> 
266                 <th>Account Type</th>
267                                 <th>Reference to</th>
268                                 <th>Remove Account</th>
269             </tr>   
270             {% for row in ref_acc %}         
271             <tr class="border_bottom">
272                 <td class="odd"> {{ row.platform_name }} </td>
273                 <td class="odd"> {{ row.account_type }} </td>
274                                 <td class="odd"> {{ row.account_reference }} </td>
275                                 <td class="odd">
276                                 <button class="btn btn-danger btn-xs" name="delete_{{row.platform_name}}" type="submit" title="Delete account from this platform">
277                                                 <span class="glyphicon glyphicon-minus"></span>
278                                         </button>
279                                 </td>
280             </tr> 
281             {%endfor%}               
282         </table>
283     </div>
284 </div>
285
286
287
288 <h3>Add reference account to the following testbeds</h3>
289 <div id="middle" align="center">
290     <div class="well">
291         <table class="mytable table table-bordered table-hover"> 
292             <tr class="odd"> 
293                 <th>Platforms</th> 
294                 <th>Add Account</th>
295             </tr>   
296             {% for platform in platform_list %}         
297             <tr class="border_bottom">
298                 <td class="odd"> {{ platform.platform_no_access }} </td>
299                 <td class="odd">
300                                         <button class="btn btn-success btn-sm" name= "add_{{platform.platform_no_access}}" type="submit" title="Add account to this platform">
301                                                 <span class="glyphicon glyphicon-plus"></span>
302                                         </button>
303                                 </td>
304             </tr> 
305             {%endfor%}               
306         </table>
307     </div>
308 </div>
309 </div>
310 {%endif%} 
311 </div>
312 </form>
313 </div>
314
315 <script>
316     $(document).ready(function() {
317         $('a.home-tab').click(function() {
318             $('ul.nav-tabs li').removeClass('active');
319             $(this).parent().addClass('active');
320             $('div.home-panel').hide();
321             $('div#'+$(this).data('panel')).show();
322         });
323         $('button#createslice').click(function() {
324             window.location="/portal/slice_request/";
325         })
326         ;$('button#slicerequestbtn').click(function() {
327             /*
328             window.location="/portal/slice_request/";
329             */
330         });
331     });
332 </script>
333
334 {% endblock %}