fixed register page validation
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Mon, 7 Jul 2014 11:26:38 +0000 (13:26 +0200)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Mon, 7 Jul 2014 11:26:38 +0000 (13:26 +0200)
portal/static/css/onelab.css
portal/templates/onelab/onelab_registration_view.html

index 3486d15..ecccdf1 100644 (file)
@@ -131,6 +131,7 @@ button.btn-onelab:active, input.btn-onelab:active {
     border-bottom:1px solid #760073;
     margin-top:2px;
 }
+
 /***** Notifications *****/
 .warning {
     border: 1px solid red;
index 2efee42..17a76cf 100644 (file)
   {% endfor %}
 </ul>
 {% endif %}
+
+
 <div class="row">
+       
        <div class="col-md-12">
-               
+                       
                        <div class="form-group">
-                               <form class="cmxform form-horizontal" id="registrationForm" method="post" enctype="multipart/form-data" role="form">
-                       {% csrf_token %}
+                               <form action="/register" class="cmxform form-horizontal" method="post" enctype="multipart/form-data">
+                               {% csrf_token %}
                                <label for="authority_hrn" class="control-label">Organization</label>
                                <p></p>
                                <input id="authority_hrn" name="org_name" class="form-control" style="width:590px" value="{{ organization }}" 
                                title="Choose your organization (company/university) from the list that apears when you click in the field and start to type.
                                 Use the arrow keys to scroll through the list; type part of the name to narrow down the list. If it is not in the list, 
                                please request its addition by clicking the link below. We will send an email to the managers that we have on record for 
-                               your organization, asking them to validate your sign-up request." required/>
+                               your organization, asking them to validate your sign-up request." required />
                                <p></p>
                                <p>Organization not listed? <a href="/portal/join">Request its addition now.</a></p>
                        </div>
                <div class="form-group">
                <input type="email" name="email" size="25"  class="form-control" style="width:350px" value="{{ email }}" 
                        title="Your e-mail address will be your identifier for logging in. We contact you to verify your account and then, occasionally, for important issues."
-                       placeholder="Email" required/>
+                       placeholder="Email" required />
                </div>
        </div>  
 
-       <!-- LOGIN
-       TODO: Login should be suggested from user email or first/last name, and
-       checked for existence. In addition, the full HRN should be shown to the
-       user.
-    <div class="form-group">
-      <label for="login" class="col-xs-2 control-label">Login</label>
-      <div class="col-xs-4">
-         <input type="text" name="login" size="25" class="form-control" minlength="2" value="{{ login }}" placeholder="Login" required />
-      </div>
-      <div class="col-xs-6"><p class="form-hint">Enter your login</p></div>
-    </div>
-       -->
        <div class="col-md-6">
            <div class="form-group">
              <label for="password" class="control-label">Authentication</label>
                  <p></p>       
              <input type="password"  id="password" name="password"   class="form-control" style="width:250px" minlength="4" value="{{ password }}" 
                        title="Your password allows you to log in to this portal."
-                       placeholder="Password" required/>
+                       placeholder="Password" required />
            </div>
            <div class="form-group">
                        <input type="password"  id="confirmpassword" name="confirmpassword" style="width:250px"  minlength="4" class="form-control" value="" 
-                               placeholder="Confirm password" required/>
+                               placeholder="Confirm password" required />
            </div>
            <div class="form-group">
-               <!--<label for="question" class="control-label">Keys</label> -->
                        <select name="question" class="form-control" style="width:350px" id="key-policy" 
-                               title="Your public/private key pair allows you to access the testbeds." required>        
+                               title="Your public/private key pair allows you to access the testbeds." required >        
                                <option value="generate">Generate my keys for me (recommended)</option>
                                <option value="upload">Upload my public key (advanced users only)</option>
                        </select>
            </div>
            <div class="form-group" style="display:none;" id="upload_key">
                <label for="file" class="control-label">Upload public key</label>
-               <input type="file" name="user_public_key" class="form-control" style="width:200px" id="user_public_key" required/>
+               <input type="file" name="user_public_key" class="form-control" style="width:200px" id="user_public_key" />
                <br />
                        <div class="alert alert-danger" id="pkey_del_msg">
                                In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to 
        <div class="col-md-12">
                <div class="form-group">
                        <p></p>
-                       <input type="checkbox" name="agreement" value="agreement" required/>&nbsp;&nbsp; I agree to the 
+                       <input type="checkbox" name="agreement" value="agreement" required />&nbsp;&nbsp; I agree to the 
                        <a href="#" data-toggle="modal" data-target="#myModal">terms and conditions.</a> 
                </div>
        </div>
                your existing credentials will be used to validate your OneLab account.
                Please be sure to specify a different password for your new OneLab account.
            </div>
-       </form> 
        </div>
 </div>
 <div class="row">
        <div class="col-md-12">
                <div class="form-group" id="register">
                        <p></p> 
-               <button class="submit btn btn-onelab" type="submit">Sign up</button>
+               <input class="submit btn btn-onelab" type="submit" value="Sign up" />
+
            </div>
-       </form> 
        </div>
 </div>
-       
-       
+</form>
+
        <!-- Modal - columns selector -->
-               <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                        <div class="modal-content">
                                <div class="modal-header">
 <p align="left">
     In the case of suspected illegal activity, OneLab management might need, without prior notice, to notify the relevant authorities.
 </p>
-<div>
-    <div>
-        <div id="_com_1">
-        </div>
-    </div>
-</div>
+
                                </div>
                                <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                </div>
                        </div>
                        </div>
-               </div>
+</div>
 
     
 <script>
@@ -541,6 +525,15 @@ jQuery(document).ready(function(){
     });
        // for hover texts
        jQuery('[title!=""]').qtip();
+       
+       $('form').submit(function() {
+               if ($('select option:selected').val() == 'upload') {
+                       if ($('input[name=user_public_key]').val() == '') {
+                               alert('Please specify the key file to upload');
+                               return false;
+                       }
+               }
+       });
 });
 </script>
 {% endblock %}