{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "users/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% set title = _('Change Email Address') %}
{% set classes = 'change_email' %}
{% set use_browserid = LANG|lower in config.BROWSERID_LOCALES.split(' ') %}

{% block content %}
<section id="content">
  <div class="wrap">
    <div id="content-main" class="full">
      <article id="change-email" class="main">
        {% if use_browserid %}
          <h1>{{ _('Change email with BrowserID') }}</h1>
            <form class="browserid boxed" action="{{url('users.browserid_change_email')}}" method="POST">
              <input type="hidden" name="next" value="{{ next_url }}" />
              {{ errorlist(form) }}
              {% trans browserid_href='https://browserid.org/', why_browserid='http://identity.mozilla.com/post/12950196039/deploying-browserid-at-mozilla' %}
              <h3>What's this?</h3>
              <p>MDN has switched to <a href="{{ browserid_href }}" target="_blank" rel="external">BrowserID</a>, a safe and simple way to sign in with just your e-mail address. 
              <a href="{{ why_browserid }}" rel="external">Learn more about why Mozilla is using BrowserID</a>.</p>
              {% endtrans %}
              <p>{% trans %}
              To change your MDN email, simply sign in below with the new email 
              address.
              {% endtrans %}</p>
              {{ browserid_form }}
              <a href="https://browserid.org/" target="_blank" class="browserid-signin" title="{{_('Sign in with BrowserID')}}">{{ _('Sign in') }}</a>
              {% if messages %}
                <ul class="messages errorlist">
                  {% for message in messages %}
                    <li {% if message.tags %} class="{{ message.tags }}"{% endif %}>
                      {{ message }}
                    </li>
                  {% endfor %}
                </ul>
              {% endif %}
            </form>
        {% else %}
          <h1>{{ title }}</h1>
          <p>
            {% trans %}
              You will need to confirm the newly set email address to complete
              the change.
            {% endtrans %}
          </p>
          <form class="boxed" method="post" action="">
            {{ csrf() }}
            <fieldset>
              <ul>
                {{ form.as_ul()|safe }}
                <li class="submit">
                  <button type="submit">{{ _('Change my email') }}</button>
                </li>
              </ul>
            </fieldset>
          </form>
        {% endif %}
      </article>
    </div>
   </div>
</section>
{% endblock content %}
