blob: 293834c4222ade272543cd31a451df17d7e739ba [file] [log] [blame]
Siobhan Tullycf04fb62014-01-11 11:25:57 -05001{% extends "admin/base_site_login.html" %}
2{% load i18n admin_static %}
3
4{% block extrastyle %}{{ block.super }}
5<link rel="stylesheet" type="text/css" href="/static/suit/bootstrap/css/bootstrap.min.css" media="all"/>
6<link rel="stylesheet" type="text/css" href="{% static "planetstack.css" %}" />
Scott Baker6985cd52014-08-05 09:51:40 -07007<script src="{% static 'suit/js/jquery-1.9.1.min.js' %}"></script>
8<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
Siobhan Tullycf04fb62014-01-11 11:25:57 -05009{% endblock %}
10
Scott Baker6985cd52014-08-05 09:51:40 -070011
Siobhan Tullycf04fb62014-01-11 11:25:57 -050012{% block bodyclass %}login{% endblock %}
13
14{% block nav-global %}{% endblock %}
15
16{% block content_title %}{% endblock %}
17
18{% block breadcrumbs %}{% endblock %}
19
20{% block content %}
21{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
22<p class="errornote">
23{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
24</p>
25{% endif %}
26
27{% if form.non_field_errors or form.this_is_the_login_form.errors %}
Scott Bakerb418d192015-01-05 16:10:57 -080028{% for error in form.non_field_errors %}
29<p class="errornote">
30 {{ error }}
31</p>
32{% endfor %}
33{% for error in form.this_is_the_login_form.errors %}
Siobhan Tullycf04fb62014-01-11 11:25:57 -050034<p class="errornote">
35 {{ error }}
36</p>
37{% endfor %}
38{% endif %}
39<div id="wrap">
40<div id="content-main">
41<h1><i class="icon-lock icon-white"></i> OpenCloud</h1>
42<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
43 <div class="form-row">
44 {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
45 {{ form.username }}
46 </div>
47 <div class="form-row">
48 {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
49 {{ form.password }}
50 <input type="hidden" name="this_is_the_login_form" value="1" />
51 <input type="hidden" name="next" value="{{ next }}" />
52 </div>
Siobhan Tullycf04fb62014-01-11 11:25:57 -050053 <div class="submit-row">
54 <input type="submit" class="btn btn-info" value="{% trans 'SIGN IN' %}" />
55 </div>
Scott Baker6985cd52014-08-05 09:51:40 -070056 <div id="requestAccountLink">{% trans 'Request a new Account' %}</div>
Siobhan Tullycf04fb62014-01-11 11:25:57 -050057</form>
Scott Baker6985cd52014-08-05 09:51:40 -070058
59<div id="request-account-form" title="Request an Account" style="display: none;">
60 <form>
61 <fieldset>
62 <div class="request-form-row">
63 <label for="request-first-name">First Name</label>
64 <input type="text" name="request-first-name" id="request-first-name">
65 </div>
66 <div class="request-form-row">
67 <label for="request-last-name">Last Name</label>
68 <input type="text" name="request-last-name" id="request-last-name">
69 </div>
70 <div class="request-form-row">
71 <label for="request-email">Email</label>
72 <input type="text" name="request-email" id="request-email">
73 </div>
74 <div class="request-form-row">
75 <label for="request-site-name">Site</label><br>
76 <select id="request-site-name" name="request-site-name">
Scott Baker5face3a2014-08-05 10:15:26 -070077 <option>---------</option>
78 {% for site in sites %}
79 {% if site.allowNewUsers %}
80 <option>{{ site.name }}</option>
81 {% endif %}
82 {% endfor %}
Scott Baker6985cd52014-08-05 09:51:40 -070083 </select>
84 </div>
85 <div class="submit-row">
86 <input id ="request-signup" class="btn btn-info" value="SIGN UP">
87 </div>
88 </fieldset>
89 </form>
90</div>
91</div>
92</div>
93
94
Siobhan Tullycf04fb62014-01-11 11:25:57 -050095<script type="text/javascript">
Scott Baker6985cd52014-08-05 09:51:40 -070096$(function() {
97 initRequest();
98});
99function initRequest(){
100 $.ajax({
101 url: '/tenantview',
102 dataType: 'json',
103 success: function (data) {
104 var sites = data['sitesToBeRequested'];
105 console.log(sites);
106 for (site in sites){
107 $("#request-site-name").append("<option>" + site + "</option>");
108 }
109 }
110 });
111}
112$("#requestAccountLink").unbind().click(function(){
113 $("#request-account-form").dialog({
114 autoOpen: false,
115 modal: true,
116 dialogClass: "requestDialog",
117 });
118 $("#request-account-form").dialog("open");
119})
120$("#request-signup").unbind().click(function(){
121 $.ajax({
122 url: '/requestaccess/',
123 dataType: 'json',
124 data: {
125 email: $("#request-email").val(),
126 firstname: $("#request-first-name").val(),
127 lastname: $("#request-last-name").val(),
128 site: $("#request-site-name").val(),
129 csrfmiddlewaretoken: "{{ csrf_token }}", // < here
130 state: "inactive"
131 },
132 async: false,
133 type: 'POST',
134 success: function () {
135 $("#request-account-form").dialog("close");
136 alert("Your request has been submitted");
137 },
138 error:function (xhr, textStatus, thrownError){
139 alert("Error:", textStatus + " " + xhr.responseText);
140 }
141 });
142})
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500143document.getElementById('id_username').focus()
144</script>
145</div>
146</div>
147{% endblock %}