<%namespace name="components" file="/components.html"/>
<%
login_types = h.allowed_login_types()
if 'username+password' in login_types and 'email+password' in login_types:
    field_title = _('Email or username:')
    field_type = 'text'
else:
    field_title = _('Login:')
    field_type =  'text'
    if 'email+password' in login_types and \
            'username+password' not in login_types:
        field_title = _('Email:')
        field_type = 'email'
%>

<div class="form_wrapper">
  %if 'shibboleth' in login_types:
  <div>
    <a href="${h.get_redirect_url('shibboleth/request_auth')}" class="button ${components.add_patch_camefrom_class()}">${_(u"Login") if c.hide_locallogin else _(u"Login via Shibboleth")}</a>
  </div>
  %endif

  %if not c.hide_locallogin:
  <form method="POST" action="${h.get_redirect_url(u'perform_login')}" class="${components.add_patch_camefrom_class()} login_form">
    <div class="input_wrapper">
      <label>${field_title}
        <input type="${field_type}" name="login" autofocus="autofocus" />
      </label>
    </div>
    <div class="input_wrapper">
      <label>${_("Password:")}
        <input type="password" name="password" />
        <a href="/reset" class="password-reset-link">${_('Forgot your password?')}</a>
      </label>
    </div>
    <div class="input_wrapper submit">
      <input type="submit" value="${_('Login')}" />
    %if h.allow_user_registration():
        ${_("or")}
        <a href="${h.register_redirect_url()}" class="more_uppercase ${components.add_patch_camefrom_class()}">
            ${_("Register new account")|n}</a>
    %endif
    </div>
  </form>
  %endif
  <script>
      $('input[name=login]').focus();
  </script>
  %if 'openid' in login_types:
      <%
      c.openid_scenario = "login"
      %>
      <%include file="/openid/form.html"/>
  %endif
</div>
