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