{% extends "charme_base.html" %}

{% load i18n %}

{% block main %}

<div class="loginform">
	<h4>Associate a new Open ID with your account</h4>
	{% if msg %}
	<div class=error>
		<ul>
			<li>{{ msg }}</li>
		</ul>
	</div>
	{% endif %}
	{% if form.non_field_errors %}
	<div class=error>
		<ul>
			<li>{{ form.non_field_errors }}</li>
		</ul>
	</div>
	{% endif %}
    <div class=accounts>
		<form action="{% url 'user_associate' %}" method="post">
		    {% csrf_token %}
		    <input type="hidden" name="next" value="{{ request.REQUEST.next }}" />
			<table>
				<tr>
					<td><label> {% trans "Select your ID provider:" noop %} </label></td>
					{% if 'Safari' in request.META.HTTP_USER_AGENT %}
					<td>
						<select name="openid_url">
							<!-- Add ID providers here -->
							<option value="https://ceda.ac.uk/openid/">CEDA</option>
						</select></td>
					{% else %}
					<td><input list="id_providers" name="openid_url">
						<datalist id="id_providers">
							<!-- Add ID providers here -->
							<option value="https://ceda.ac.uk/openid/">CEDA</option>
						</datalist></td>
					{% endif %}	
					<td class=error>{{ form.openid_url.errors }}</td>
				</tr>
				<tr>
					<td></td>
					<td style="text-align: right;">
						<input type="submit" value="Add OpenID">
						<input type="button" 
						onclick="location.href='{% url 'profile' %}'"
						value="Cancel" /></td>
					<td></td>
				</tr>
			</table>
		</form>
	</div>
</div>

{% endblock %}
