summaryrefslogtreecommitdiffstats
path: root/hyperkitty/templates/login.html
blob: 3eeee8cbe512a0b09b492d3982e6421e4a07cce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% load crispy_forms_tags %}


{% block title %}
{% trans 'Login' %} - {{ app_name|title }}
{% endblock %}

{% block content %}

<div id="login">


<h2>Login with your email</h2>
<ul class="social-login inline">
	<li>
		<form method="post" action="{% url 'socialauth_complete' "browserid" %}?next={{ next }}">
			{% csrf_token %}
			<input type="hidden" name="assertion" value="" />
			<a rel="nofollow" id="browserid" href="#" class="disabled"><img src="{{ STATIC_URL }}img/login/persona-large-disabled.png" alt="Login using Persona" /></a>
		</form>
	</li>
	<li><a title="Google" class="socialaccount_provider google" href="{% url 'socialauth_begin' backend='google' %}"><img src="{{ STATIC_URL }}img/login/google.png" alt="Google"></a></li>

	<li><a title="Yahoo" class="socialaccount_provider yahoo" href="{% url 'socialauth_begin' backend='yahoo' %}"><img src="{{ STATIC_URL }}img/login/yahoo.png" alt="Yahoo"></a></li>
</ul>


{% if use_internal_auth %}
<h2>Login with username and password</h2>

<form action="{{ request.path }}?next={{ next|urlencode }}" method="post" class="form-horizontal">
	{% csrf_token %}
	{{ form|crispy }}
	<div class="control-group">
		<div class="controls">
			<button type="submit" class="btn btn-primary">{% trans "Login" %}</button>
		</div>
	</div>
</form>
{% endif %}


</div>

{% endblock %}

{% block additionaljs %}
<!-- Include BrowserID JavaScript -->
<script src="https://browserid.org/include.js" type="text/javascript"></script>
<!-- Setup click handler that receives BrowserID assertion code and sends POST data -->
<script type="text/javascript">
	$(function() {
		$('#browserid').click(function(e) {
			e.preventDefault();
			var self = $(this);

			navigator.id.get(function(assertion) {
				if (assertion) {
					self.parent('form').find('input[type=hidden]').attr('value', assertion).end().submit();
				} else {
					alert('Some error occurred');
				}
			});
		}).each(function() {
			var img = $(this).find("img");
			img.attr("src", img.attr("src").replace(/-disabled/, ""));
			$(this).removeClass("disabled");
		});
	});
</script>
<!-- end browserid stuff -->
<script type="text/javascript">
	var username = document.getElementById('id_username');
	if (username) { username.focus(); }
</script>
{% endblock additionaljs %}

{# vim: set noet: #}