50b7fffd6ecd62836f1a34c822ba957f73e2a55e
[unfold.git] / portal / templates / fed4fire / fed4fire_registration_view.html
1 {% extends "layout.html" %}
2
3 {% block content %}        
4
5 <div class="row">
6         <div class="col-md-12">
7         <h1><img src="{{ STATIC_URL }}icons/user-xs.png" alt="User Registration" />User sign-up</h1>
8         </div>
9 </div>
10 <div class="row">
11         <div class="col-md-12">
12                 <p><strong>Questions? <a href="/contact" >Contact us.</a></strong></p>
13   </div>
14 </div>
15 {% if errors %}
16 <div class="row">
17         <div class="col-md-12">
18                 <ul class="error">
19                   {% for error in errors %}
20                   <li>{{ error | safe }}</li>
21                   {% endfor %}
22                 </ul>
23         </div>
24 </div>
25 {% endif %}
26 <form action="/register" class="cmxform form-horizontal" method="post" enctype="multipart/form-data">
27 <div class="row">
28         <div class="col-md-12">
29                         <p>
30                                 {% csrf_token %}
31                                 <label for="authority_hrn" class="control-label">Organization</label>
32                         </p>
33                         <p>
34                                 <select id="org_name" name="org_name" class="form-control" style="width:590px" value="{{ organization }}" 
35                                 title="Choose your organization (company/university) from the list that apears when you click in the field and start to type.
36                                  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 
37                                  the managers that we have on record for your organization, asking them to validate your sign-up request." required>
38                     <option value="">select an organization</option>
39                 {% if authorities %}
40                     {% for authority in authorities %}
41                         {% if authority.name %}
42                             <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
43                         {% else %}
44                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
45                         {% endif %}
46                     {% endfor %}
47                 {% else %}
48                     <option value:"">No authority found !!!</option>
49                 {% endif %}
50                 </select>
51             </p>
52                                 <p class="help-block">If your organization does not deploy a Fed4FIRE authority itself, you can use the<br> default one called "fed4fire.global".
53                 If your organization however does provide a<br> Fed4FIRE authority itself, please make sure to select it here. If you start typing<br> your organization's
54                  name, it will pop up.
55                 </p> 
56         </div>
57 </div>
58
59 <div class="row">
60         <div class="col-md-6">
61         <p>
62                         <label for="firstname" class="control-label">Personal information</label>
63                 </p>
64         <p>
65                         <input type="text" name="firstname" class="form-control" style="width:350px" minlength="2" value="{{ first_name }}" placeholder="First name" required />
66             </p>
67         <p>
68                         <input type="text" name="lastname" size="25" class="form-control" style="width:350px" minlength="2" value="{{ last_name }}" placeholder="Last name" required />
69             </p>
70         <p>
71                 <input type="email" name="email" size="25"  class="form-control" style="width:350px" value="{{ email }}" 
72                         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."
73                         placeholder="Email" required />
74                 </p>
75         </div>  
76
77         <div class="col-md-6">
78         <p>
79               <label for="password" class="control-label">Authentication</label>
80                 </p>
81                 <p>     
82               <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 />
83             </p>
84         <p>
85                         <input type="password"  id="confirmpassword" name="confirmpassword" style="width:250px"  minlength="8" class="form-control" value="" placeholder="Confirm password" required />
86             </p>
87         <p>
88                         <select name="question" class="form-control" style="width:350px" id="key-policy" 
89                                 title="Your public/private key pair allows you to access the testbeds." required >        
90                                 <option value="generate">Generate my keys for me (recommended)</option>
91                                 <option value="upload">Upload my public key (advanced users only)</option>
92                         </select>
93             </p>
94             <div style="display:none;" id="upload_key">
95                 <label for="file" class="control-label">Upload public key</label>
96                 <input type="file" name="user_public_key" class="form-control" style="width:200px" id="user_public_key" />
97                 <br />
98                         <div class="alert alert-danger" id="pkey_del_msg">
99                                 In order for the portal to contact testbeds on your behalf, so as to list and reserve resources, you will need to 
100                                 <a href="/portal/manual_delegation" target="_blank">delegate your credentials to the portal.</a>
101                         </div>
102             </div>
103         </div>
104 </div>
105 <div class="row">
106         <div class="col-md-12">
107         <p>
108                         <input type="checkbox" name="agreement" value="agreement" required />&nbsp;&nbsp; I agree to the 
109                         <a href="#" data-toggle="modal" data-target="#myModal">terms and conditions.</a> 
110                 </p>
111         </div>
112 </div>
113 <div class="row">
114         <div class="col-md-12">
115                 <div id="register">
116                         <p>
117                 <input class="submit btn btn-onelab" type="submit" value="Sign up" />
118                </p>
119             </div>
120         </div>
121 </div>
122 </form>
123         <!-- Modal - columns selector -->
124 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
125         <div class="modal-dialog">
126                 <div class="modal-content">
127                         <div class="modal-header">
128                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
129                                         <h4 class="modal-title" id="myModalLabel">Terms & Conditions</h4>
130                         </div>
131                         <div class="modal-body">
132                                 <p align="left">
133                                         The exact terms and conditions for Fed4FIRE are currently under development.
134                                 </p>
135
136                         </div>
137                         <div class="modal-footer">
138                                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
139                         </div>
140                 </div>
141         </div>
142 </div>
143
144     
145 <script>
146
147 $(document).ready(function(){
148     /*
149     var availableTags = [
150     {% if authorities %}
151         {% for authority in authorities %}
152             {% if authority.name %}
153                 {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
154                         // show hrn if we don't have the name
155             {% else %}
156                 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
157             {% endif %}
158         {% endfor %}    
159     {% else %}
160         {value:"",label:"No authority found !!!"}
161     {% endif %}
162     ];
163         // sorting the list
164     
165         availableTags.sort(function(a,b){
166                 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
167                 if (nameA < nameB) {
168                 return -1;
169                 }
170                 if (nameA > nameB) {
171                 return 1;
172                 }
173         return 0;
174         }); 
175     */
176     
177         // auto-complete the form
178     jQuery("#org_name").combobox();
179
180     //setting the default value in the org_list
181     var temp="fed4fire.global"; 
182     $("#org_name").val(temp);
183
184     /*
185     // Must be executed in Python as Admin Query - User is not logged in
186
187     $.post("/rest/authority/",{'filters':{'authority_hrn':'CONTAINS'+temp}}, function( data ) {
188         $.each( data, function( key, val ) {
189             console.log(val);
190         });
191     });
192     */
193         $('[title!=""]').qtip();
194         $("form").validate();
195         $("form").submit(function() {
196                 if ($('select option:selected').val() == 'upload') {
197                         if ($('input[name=user_public_key]').val() == '') {
198                                 alert('Please specify the key file to upload');
199                                 return false;
200                         }
201                 }
202         });
203 });
204 </script>
205 {% endblock %}
206