<%namespace name="sso" file="/sso.html"/>

<div class="form_wrapper">
  <form name="create_user" method="POST" action="${h.get_redirect_url(u'user')}">
    ${h.field_token()|n}

    <% randomizeid_user_names = h.config.get_bool('adhocracy.force_randomized_user_names') %>
    %if not randomized_user_names:
    <fieldset>
      <legend>${_("User name")}</legend>
      <p class="info">${_("Can only contain letters and numbers. Spaces aren't allowed.")}</p>
      <div class="input_wrapper">
        <input type="text" autofocus="autofocus" name="user_name" />
      </div>
    </fieldset>
    %endif
    %if h.config.get_bool('adhocracy.set_display_name_on_register'):
    <fieldset>
      <legend>${_("Display name")}</legend>
      <p class="info">${_("You can choose which name other users see.")}</p>
      <div class="input_wrapper">
        <input type="text" class="title" name="display_name"
               ${u'autofocus="autofocus"' if randomized_user_names else u''|n} />
      </div>
    </fieldset>
    %endif

    <fieldset>
      <legend>${_("E-mail")}</legend>
      <div class="input_wrapper">
        <input type="text" name="email" />
      </div>
    </fieldset>

    <fieldset>
      <legend>${_("Password")}</legend>
      <div class="input_wrapper">
        <label for="password">${_("Enter password:")}</label>
        <input type="password" name="password" />
        <label for="password_confirm">${_("Password (confirm):")}</label>
        <input type="password" name="password_confirm" />
      </div>
    </fieldset>

    %if c.captcha:
    <fieldset>
      <legend>${_("Security query")}</legend>
      <p class="info">${_("Please enter the letters in the following image in the field below.")}</p>
      ${c.captcha|n}
    </fieldset>
    %endif

    <p>
      %if c.agree_text is None:
        ${_("By registering, you agree with the %s.") % h.help_link(_("Terms and Conditions"), 'terms') |n}
        ${_(u"We'll occasionally inform you about important events such as the start of a new participation process via email.")}
      %else:
        ${c.agree_text|n}
      %endif
    </p>

    ## <!--SPAM protection-->
    <div class="hidejs" id="register_input_js">
      <label for="input_js">JS ${_('leave empty')}</label>
      <input name="input_js" />
    </div>
    <div id="register_input_css">
      <label for="input_css">CSS ${_('leave empty')}</label>
      <input name="input_css" />
    </div>

    <div class="input_wrapper submit">
      <input type="submit" value="${_('Register')}" />
    </div>
  </form>
  <script>
      $('input[name=user_name]').focus();
  </script>

  <%sso:form scenario="register" />
</div>
