{% extends "charme_base.html" %}

{% load i18n %}

{% block main %}

<h2>Login</h2>

{% if next %}
    <p>Please login to see this page.</p>
{% endif %}

<hr class="clear" />

<div class=loginform>
	<h4>Sign In Using Your Account ID</h4>
	{% if form.non_field_errors %}
	<div class=error>
		<ul>
			<li>{{ form.non_field_errors }}</li>
		</ul>
	</div>
	{% endif %}
	<div class=accounts>
		<form method="post" action="{% url 'login' %}">
			{% csrf_token %}
    		<input type="hidden" name="next" value="{{ request.REQUEST.next }}" />
   			<table>
				<tr>
					<td><label> {% trans "Username:" noop %} </label></td>
					<td>{{ form.username }}</td>
					<td class=error>{{ form.username.errors }}</td>
				</tr>
				<tr>
					<td><label> {% trans "Password:" noop %} </label></td>
					<td>{{ form.password }}</td>
					<td class=error>{{ form.password.errors }}</td>
				</tr>
				<tr>
					<td></td>
					<td style="text-align: right;">
						<input type="submit" value="Sign in"></td>
					<td></td>
				</tr>
			</table>
		</form>
	</div>
</div>

<hr class="clear" />

<div class=loginform>
	<h4>Sign In Using Your OpenID URL</h4>
	{% if msg %}
	<div class=error>
		<ul>
			<li>{{ msg }}</li>
		</ul>
	</div>
	{% endif %}
	{% if openid_form.non_field_errors %}
	<div class=error>
		<ul>
			<li>{{ openid_form.non_field_errors }}</li>
		</ul>
	</div>
	{% endif %}
    <div class=accounts>		
		<form method="post" action="{% url 'login' %}">
			{% csrf_token %}
    		<input type="hidden" name="next" value="{{ request.REQUEST.next }}" />
			<table>
				<tr>
					<td><label> {% trans "Open ID:" noop %} </label></td>
					<td><input name="openid_url" type="text" value="https://" /></td>
					<td class=error>{{ openid_form.openid_url.errors }}</td>
				</tr>
				<tr>
					<td></td>
					<td style="text-align: right;">
						<input type="submit" value="Sign in with OpenID"></td>
					<td></td>
				</tr>
			</table>
		</form>
	</div>
</div>

<hr class="clear" />

<p><a href="{% url 'username_reminder' %}">Forgotten username</a></p>
<p><a href="{% url 'password_reset' %}">Forgotten password</a></p>
<p><a href="{% url 'registration' %}">Register</a></p>

{% endblock %}
