blob: a1657073094dca4bde8306b1883190e7a59f3182 [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 %}
28{% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
29<p class="errornote">
30 {{ error }}
31</p>
32{% endfor %}
33{% endif %}
34<div id="wrap">
35<div id="content-main">
36<h1><i class="icon-lock icon-white"></i> OpenCloud</h1>
37<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
38 <div class="form-row">
39 {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
40 {{ form.username }}
41 </div>
42 <div class="form-row">
43 {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
44 {{ form.password }}
45 <input type="hidden" name="this_is_the_login_form" value="1" />
46 <input type="hidden" name="next" value="{{ next }}" />
47 </div>
Siobhan Tullycf04fb62014-01-11 11:25:57 -050048 <div class="submit-row">
49 <input type="submit" class="btn btn-info" value="{% trans 'SIGN IN' %}" />
50 </div>
Scott Baker6985cd52014-08-05 09:51:40 -070051 <div id="requestAccountLink">{% trans 'Request a new Account' %}</div>
Siobhan Tullycf04fb62014-01-11 11:25:57 -050052</form>
Scott Baker6985cd52014-08-05 09:51:40 -070053
54<div id="request-account-form" title="Request an Account" style="display: none;">
55 <form>
56 <fieldset>
57 <div class="request-form-row">
58 <label for="request-first-name">First Name</label>
59 <input type="text" name="request-first-name" id="request-first-name">
60 </div>
61 <div class="request-form-row">
62 <label for="request-last-name">Last Name</label>
63 <input type="text" name="request-last-name" id="request-last-name">
64 </div>
65 <div class="request-form-row">
66 <label for="request-email">Email</label>
67 <input type="text" name="request-email" id="request-email">
68 </div>
69 <div class="request-form-row">
70 <label for="request-site-name">Site</label><br>
71 <select id="request-site-name" name="request-site-name">
Scott Baker5face3a2014-08-05 10:15:26 -070072 <option>---------</option>
73 {% for site in sites %}
74 {% if site.allowNewUsers %}
75 <option>{{ site.name }}</option>
76 {% endif %}
77 {% endfor %}
Scott Baker6985cd52014-08-05 09:51:40 -070078 </select>
79 </div>
80 <div class="submit-row">
81 <input id ="request-signup" class="btn btn-info" value="SIGN UP">
82 </div>
83 </fieldset>
84 </form>
85</div>
86</div>
87</div>
88
89
Siobhan Tullycf04fb62014-01-11 11:25:57 -050090<script type="text/javascript">
Scott Baker6985cd52014-08-05 09:51:40 -070091$(function() {
92 initRequest();
93});
94function initRequest(){
95 $.ajax({
96 url: '/tenantview',
97 dataType: 'json',
98 success: function (data) {
99 var sites = data['sitesToBeRequested'];
100 console.log(sites);
101 for (site in sites){
102 $("#request-site-name").append("<option>" + site + "</option>");
103 }
104 }
105 });
106}
107$("#requestAccountLink").unbind().click(function(){
108 $("#request-account-form").dialog({
109 autoOpen: false,
110 modal: true,
111 dialogClass: "requestDialog",
112 });
113 $("#request-account-form").dialog("open");
114})
115$("#request-signup").unbind().click(function(){
116 $.ajax({
117 url: '/requestaccess/',
118 dataType: 'json',
119 data: {
120 email: $("#request-email").val(),
121 firstname: $("#request-first-name").val(),
122 lastname: $("#request-last-name").val(),
123 site: $("#request-site-name").val(),
124 csrfmiddlewaretoken: "{{ csrf_token }}", // < here
125 state: "inactive"
126 },
127 async: false,
128 type: 'POST',
129 success: function () {
130 $("#request-account-form").dialog("close");
131 alert("Your request has been submitted");
132 },
133 error:function (xhr, textStatus, thrownError){
134 alert("Error:", textStatus + " " + xhr.responseText);
135 }
136 });
137})
Siobhan Tullycf04fb62014-01-11 11:25:57 -0500138document.getElementById('id_username').focus()
139</script>
140</div>
141</div>
142{% endblock %}