MyAcc: using JS confirm instead of JS Alert
authorYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 20 Jan 2014 17:02:53 +0000 (18:02 +0100)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 20 Jan 2014 17:02:53 +0000 (18:02 +0100)
portal/accountview.py
portal/static/css/account_view.css
portal/static/js/my_account.edit_profile.js
portal/templates/account-view.html

index 73b55fd..f3a1527 100644 (file)
@@ -328,7 +328,7 @@ def account_process(request):
                         public_key = public_key.replace('"', '');
                         user_pub_key = {'keys': public_key}
                         sfa_update_user(request, user_hrn, user_pub_key)
-                        messages.success(request, 'Sucess: New Keypair Generated!')
+                        messages.success(request, 'Sucess: New Keypair Generated! Delegation of your credentials will be automatic.')
                         return HttpResponseRedirect("/portal/account/")
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
@@ -413,6 +413,7 @@ def account_process(request):
                             user_params = { 'config': updated_config, 'auth_type':'user'}
                             manifold_update_account(request,user_params)
                             messages.success(request, 'Private Key deleted. You need to delegate credentials manually once it expires.')
+                            messages.success(request, 'Once your credentials expire, Please delegate manually using SFA: http://trac.myslice.info/wiki/DelegatingCredentials')
                             return HttpResponseRedirect("/portal/account/")
                         else:
                             messages.error(request, 'Delete error: Private key is not stored in the server')
index f445aee..4984ed0 100644 (file)
@@ -262,6 +262,24 @@ table.profile button {
   margin-right: 15px;
 }
 
+#delete {
+  width: 80px;
+  vertical-align: middle;
+  float: right;
+  margin-right: 15px;
+
+}
+
+#upload_key {
+  width: 80px;
+  vertical-align: middle;
+  float: right; 
+  margin-right: 15px;
+
+}
+
+
+
 table.profile span.hide_this{ 
        display: inline;
        display: none;
index dcbfbb3..70607ba 100644 (file)
@@ -162,16 +162,19 @@ jQuery(document).ready(function(){
                       });
                   });
 
-// alert box for the "Generate new Key Pair button"
-function myFunction()
+
+function editAlert()
 {
-alert("You have requested to generate new key pairs. Please download and save the new keypairs after receiving the success message.");
+alert("You can't edit email/authority. Please contact support and specify your requirements.");
+window.location.href = "/portal/contact/";
 }
 
-function emailAlert()
+
+/*
+// alert box for the "Generate new Key Pair button"
+function myFunction()
 {
-alert("To edit email please contact the administratior. You will be redirected to the support page now");
-window.location.href = "/portal/contact/";
+alert("You have requested to generate new key pairs. Please download and save the new keypairs after receiving the success message.");
 }
 
 function affAlert()
@@ -179,7 +182,7 @@ function affAlert()
 alert("To edit affiliation please contact the administratior. You will be redirected to the support page now");
 window.location.href = "/portal/contact/";
 }
-/*
+
  // alert having ok or cancel option
 function show_confirm()
 {
index 83e03d3..3c3d543 100644 (file)
@@ -26,7 +26,7 @@
                                <td class="key">Email</td>
                                <td class="value">
                                                <span id="emailval" class="value" >{{ person.email }}</span>
-                                               <button class="btn btn-default btn-xs" type="button" id="edit_email" onclick="emailAlert()"  title="To change your affiliation please contact the administrator">
+                                               <button class="btn btn-default btn-xs" type="button" id="edit_email" onclick="editAlert()"  title="To change your affiliation please contact the administrator">
                                                <span class="glyphicon glyphicon-question-sign"></span> Edit
                                                </button>
                                        </td>
                                        <td class="key">Authority</td>
                                        <td class="value">
                                                <span id="affval" class="value">{{ authority }}</span>
-                                                <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="affAlert()"  title="To change your authority please contact the administrator">
+                                                <button class="btn btn-default btn-xs" type="button" id="edit_auth" onclick="editAlert()"  title="To change your authority please contact the administrator">
                                                <span class="glyphicon glyphicon-question-sign"></span> Edit
                                                 </button>
                                        </td>
                                </tr>
                                <tr class="even">
                                        <td class="key">Generate Keys</td>
-                                       <td> 
-                                               <button id="generate_keypair" class="btn btn-danger btn-xs" name="generate" type="submit" onclick="myFunction()
-                                                               title="Generate a new key pair. After it is generated, you will need to download your public and private keys again.">Generate a new Key Pair 
-                                               </button>
+                                       <td>
+                                               <input type="submit" name="generate" class="btn btn-danger btn-xs" value="Generate a new Key Pair" id="generate_keypair
+                                                          onclick="return confirm('Are you sure? If you do so, your current credentials will be overwritten.');" 
+                                                          title="It will generate a new key Pair and your current credentials will be overwritten."/>
                                </td> 
                        </tr>
                        <tr class="odd">
                                                <span class="hide_this" id="span_upload">
                                                        <button type="button" class="btn btn-default btn-xs" title="Cancel" id="cancel_upload"> Cancel </button>
                                                        <div style='display:none;'>
-                                                       <input type='hidden'  name='upload'  /></div>
-                                                       <input type="file" name="pubkey" class="required" id="pubkey"/>  
-                                                       <button class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key">
-                                                               <span class="glyphicon glyphicon-upload"></span> Upload
-                                                       </button>
+                                                               <input type='hidden'  name='upload'  /></div>
+                                                               <input type="file" name="pubkey" class="required" id="pubkey"/>  
+                                                               <input class="btn btn-default btn-xs" name="upload_key" id="upload_key"  type="submit" title="Upload your public key" value="Upload"
+                                                                  onclick="return confirm('Are you sure? It will overwrite your current credentials and you have delegate it manually.');"/>
                                                </span>
                                                <div style='display:none;'> <input type='hidden'  name='dload'  /> </div> 
                                                <button type="submit" name="dl_pubkey" class="btn btn-default btn-xs" title="Download your public key" id="dl_file">
                                        <button type="submit" name="dl_pkey" class="btn btn-default btn-xs" title="Download your privaye key" id="dl_pkey">
                                                        <span class="glyphicon glyphicon-download"></span> Download     
                                                </button>
-                                       <button class="btn btn-danger btn-xs" id="delete" name="delete" type="submit" title="Delete your private key">Delete </button>
+                                       <input class="btn btn-danger btn-xs" id="delete" name="delete" type="submit"  value="Delete" title="Delete your private key"
+                                                               onclick="return confirm('Are you sure? If you do so, you have to delegate your credentials manually.');"/> 
                                </td>
                                  {%else%}
                                        <td class="key">Private Key </td> <!-- Hide if priv_key doesn't exist in myslice platform   -->
                                        <button type="submit" name="dl_pkey" class="btn btn-default btn-xs disabled" title="Download your privaye key" id="dl_pkey">
                                                <span class="glyphicon glyphicon-download"></span> Download 
                                        </button>
-                               <button class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key">Delete </button>
+                                       <input class="btn btn-danger btn-xs disabled" id="delete" name="delete" type="submit" title="Delete your private key"
+                                                               value="Delete"  />
                                        </td>
                                 {%endif%}              
                                </tr>