Registration using Names from Registry
[unfold.git] / portal / templates / registration_view.html
index 82a343f..ec90abf 100644 (file)
-{% extends "layout-unfold1.html" %}
+{% extends "layout.html" %}
 
-{% block head %}
-<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/onelab.css" />
-<!-- xxx ideally only onelab.css but ... xxx -->
-<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/registration.css" />
-<script type="text/javascript" src="{{STATIC_URL}}/jquery.validate.js"></script> 
-<script type="text/javascript" src="{{STATIC_URL}}/my_account.register.js"></script>
-{% endblock %}                              
-                                    
-{% block unfold1_main %}        
+{% block content %}        
 
+<div class="row">
+       <div class="col-md-12">
+       <h1><img src="{{ STATIC_URL }}icons/user-xs.png" alt="User Registration" />User sign-up</h1>
+       </div>
+</div>
+<div class="row">
+       <div class="col-md-12">
+               <p><strong>Questions? <a href="/contact" >Contact us.</a></strong></p>
+  </div>
+</div>
 
 {% if errors %}
-<ul>
-  {% for error in errors %}
-  <li>{{ error }}</li>
-  {% endfor %}
-</ul>
+<div class="row">
+       <div class="col-md-12">
+               <ul class="error">
+                 {% for error in errors %}
+                 <li>{{ error | safe }}</li>
+                 {% endfor %}
+               </ul>
+       </div>
+</div>
 {% endif %}
+<form action="/register" class="cmxform form-horizontal" method="post" enctype="multipart/form-data">
+<div class="row">
+       <div class="col-md-6">
+           <div>
+                               {% csrf_token %}
+                               <label for="authority_hrn" class="control-label">Organization</label>
+                               <p></p>
+                <div class="ui-widget">
+                               <select id="org_name" 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. 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>
+                    <option value="">select an organization</option>
+                {% if authorities %}
+                    {% for authority in authorities %}
+                        {% if authority.name %}
+                                <option value="{{ authority.authority_hrn }}">{{authority.shortname}} - {{authority.name}}</option>
+                        {% else %}
+                            <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
+                        {% endif %}
+                    {% endfor %}               
+                {% else %}
+                    <option value:"">No authority found !!!</option>
+                {% endif %}
+                </select>
+                </div>
+                               <p></p>
+                {% include theme|add:"_authority_notListed.html" %}
+               </div>
+       </div>
+</div>
 
+<div class="row">
+       <div class="col-md-6">
+          <p>
+                       <label for="firstname" class="control-label">Personal information</label>
+          </p>
+          <p>
+                       <input type="text" name="firstname" class="form-control" style="width:350px" minlength="2" value="{{ first_name }}" placeholder="First name" required />
+           </p>
+           <p>
+                       <input type="text" name="lastname" size="25" class="form-control" style="width:350px" minlength="2" value="{{ last_name }}" placeholder="Last name" required />
+           </p>
+               <p>
+               <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 />
+               </p>
+       </div>  
 
-<div class="onelab-title well well-lg">
-  <h2>OneLab Experimenter Registration</h2>
-  <h4>For First Line Support please <a href="/portal/contact" >Contact Support</a></h3>
+       <div class="col-md-6">
+           <p>
+             <label for="password" class="control-label">Authentication</label>
+               </p>    
+               <p>
+             <input type="password"  id="password" name="password"   class="form-control" style="width:250px" minlength="8" value="{{ password }}" 
+                       title="Your password allows you to log in to this portal."
+                       placeholder="Password" required />
+           </p>
+           <p>
+                       <input type="password"  id="confirmpassword" name="confirmpassword" style="width:250px"  minlength="8" class="form-control" value="" 
+                               placeholder="Confirm password" required />
+           </p>
+           <p>
+                       <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 >        
+                               <option value="generate">Generate my keys for me (recommended)</option>
+                               <option value="upload">Upload my public key (advanced users only)</option>
+                       </select>
+           </p>
+           <div 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" />
+               <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 
+                               <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
+                       </div>
+           </div>
+       </div>
+</div>
+<div class="row">
+       <div class="col-md-12">
+               <p>
+                       <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> 
+               </p>
+       </div>
+</div>
+{% include theme|add:"_register_info.html" %}
+<div class="row">
+       <div class="col-md-12">
+               <div id="register">
+                       <p>
+               <input class="submit btn btn-onelab" type="submit" value="Sign up" />
+               </p>
+               </form>
+           </div>
+       </div>
 </div>
-   
-<div class="well">
-<form class="cmxform" id="commentForm" method="post" action="" enctype="multipart/form-data" >
-{% csrf_token %}
- <fieldset>
-   <div class="field">
-     <label for="cname">First Name</label>
-     <input type="text" id="firstname" name="firstname" size="25" class="required" minlength="2" value="{{ firstname}}" /> 
-     <p class="hint">Enter your first name</p>
-     <?php echo $errfName;?>
-   </div>
-   <div class="field">
-     <label for="lname">Last Name</label>
-     <input type="text" id="lastname" name="lastname" size="25" class="required" minlength="2" value="{{ lastname }}"/> 
-     <p class="hint">Enter your last name</p>
-     <?php echo $errlName;?>
-   </div>
-   <!-- DEPRECATED
-       <div class="field">
-     <label for="aff_list">Affiliation</label>
-     <input type="text" id="aff_list" name="affiliation" size="25" class="required"  value="{{ affiliation }}"/> 
-     <p class="hint">Enter your Institution name</p>
-     <?php echo $erraffiliation;?>
-   </div>
-       -->
-    <div class="field">
-      <label for="auth_list">Authority</label>
-      <select id="auth_list" name="authority_hrn" size="1" class="required">
-        {% for authority in authorities %}
-        <option value="{{ authority.authority_hrn }}"/>{{authority.name}} ({{authority.authority_hrn}})</option>
-        {% endfor %}
-     </select>
-     <p class="hint">Please select an authority responsible for vetting your account</p>
-   </div>
-
-   <div class="field">
-     <label for="cemail">Email</label>
-     <input type="text" id="email" name="email" size="25"  class="required email" value="{{ email }}"/> 
-     <p class="hint">Enter a valid email address</p>
-     <?php echo $errEmail; ?>
-   </div>
-   <div class="field">
-     <label for="password">Password</label>
-     <input type="password"  id="password" name="password"   class="required" minlength="4" value="{{ password }}"/> 
-     <p class="hint">Enter password</p>
-     <?php //echo $errPass;?>
-   </div>
-   <div class="field">
-     <label for="password">Confirm Password</label>
-     <input type="password"  id="confirmpassword" name="confirmpassword"   minlength="4" class="required" value=""/>
-     <p class="hint">Retype the password</p>
-   </div>
-   <div class="field">
-      <label for="question">My Keys</label>
-      <select name="question" class="required" id="question">        
-        <option value="generate">Generate key pairs for me </option>
-        <option value="upload">Upload my public key </option>
-      </select>
-               <p class="hint">Genkey: Account Delegation Automatic (Recommended)</p> 
-      <?php echo $errFile; ?>
-   </div>
-   <div class="field" style="display:none;" id="upload_key">
-      <label for="file">Upload public key</label>
-      <input type="file" name="user_public_key" class="required" id="user_public_key"/>
-      <p class="hint">Account Delegation: Manual (Advanced Users)</p>
-         <p class="warning" id="pkey_del_msg">Once your account is validated, you have to delegate your credentials manually using SFA [Advanced users only]</p>
 
-   </div>
-   <div class="field" id="register">
-     <input class="submit btn" type="submit"  name="submit" value="Register"/>
-   </div>
- </fieldset>
-</form>
+       <!-- Modal - columns selector -->
+<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">
+                                       <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                                               <h4 class="modal-title" id="myModalLabel">Terms & Conditions</h4>
+                               </div>
+                               <div class="modal-body">
+                    {% include theme|add:"_terms_and_conditions.html" %}
+                               </div>
+                               <div class="modal-footer">
+                                       <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+                               </div>
+                       </div>
+                       </div>
 </div>
+    
+<script>
+$(document).ready(function(){
 
-{% endblock %}
+       // auto-complete the form
+    jQuery("#org_name").combobox();
+    
+    {% if theme == 'fed4fire' %}
+    //setting the default value in the org_list
+    var temp="fed4fire.global"; 
+    $("#org_name").val(temp);
+    {% endif %}
 
+       $('[title!=""]').qtip();
+       $("form").validate();
+       $("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 %}