<% #main %>
<h1>
   <% response.title %>
   <% members.link add ' ' class='uk-icon-button uk-icon-plus uk-text-middle' %>
</h1>
<% members.link . <% gettext All %> %>
<% members.link subscribers <% gettext Subscribers %> prefix='| ' %>
<% members.link contributors <% gettext Contributors %> prefix="| " %>
<% members.link managers <% gettext Managers %> prefix="| " %>
<% members.link owners <% gettext Owners %> prefix="| " %>
<% response.pager %>
<table class='uk-table uk-table-striped uk-table-hover uk-table-condensed'>
   <thead>
      <tr>
         <th><% gettext Name %></th>
         <th><% gettext Role %></th>
         <th><% gettext Subscribed %></th>
         <th></th>
      </tr>
   </thead>
   <tbody>
      <% response.list %>
   </tbody>
</table>
<% response.pager %>

<% #login %>
<h1><% response.title %></h1>
<form class='uk-form uk-form-stacked' id="login" method="post" action="<% response.action %>">
   <input type="hidden" name="digest" id="digest" />
   <div class='uk-form-row'>
      <label class='uk-form-label' for='name'>
         <% gettext Account %>
      </label>
      <div class='uk-form-controls'>
         <input name="name" id="name" tabindex=1 value="<% request.name encoding="form" %>" class='uk-width-1-2' required>
         <% members.link register <% gettext "Not registered yet\?" %> class='uk-button uk-button-link' tabindex=6 %>
      </div>
   </div>
   <div class='uk-form-row'>
      <label class='uk-form-label' for='password'>
         <% gettext Password %>
      </label>
      <div class='uk-form-controls uk-form-password uk-width-1-2'>
         <input type="password" name="password" id="password" class='uk-width-1-1' tabindex=2 required>
         <a href='javascript:' class='uk-form-password-toggle' data-uk-form-password="{
            lblHide: '<% gettext Hide %>',
            lblShow: '<% gettext Show %>'
         }"><% gettext Show %></a>
      </div>
      <% members.link reset <% gettext 'Password forgotten\?' %>  class='uk-button uk-button-link' tabindex="7" %>
   </div>
   <div class='uk-form-row'>
      <label>
         <input type="checkbox" id="remember" name="remember" tabindex="3" <% if <% request.remember %> is on then 'checked="checked"' %> >
         <% gettext "Remember Login" %>
      </label>
   </div>
   <div class='uk-form-row'>
      <input hidden name='login' value='1'>
      <button class='uk-button uk-button-primary' type="submit" tabindex=4>
         <% gettext Login context=verb %>
      </button>
      <a href='<% site.href %>' class="uk-button uk-button-link" tabindex=5><% gettext Cancel %></a>
   </div>
</form>
<% story <% root.termsStory %> link text=<% gettext "Terms and Conditions" %> prefix='<div class="uk-margin-top"><i class="uk-icon-legal"></i> ' suffix=</div> %>
<% story <% root.privacyStory %> link text=<% gettext "Data Privacy Statement" %> prefix='<div><i class="uk-icon-cloud-upload"></i> ' suffix=</div> %>
<script type="text/javascript">
   $("form#login").on('submit', function (event) {
      if ($('#digest').val()) {
         return true;
      }
      var form = $(this);
      event.preventDefault();
      var name = $("#name").val();
      $.ajax({
         url: '<% members.href salt.txt %>',
         data: "user=" + encodeURIComponent(name),
         dataType: "text",
         cache: false,
         error: function() { /* ... */ },
         success: function(salt, status, xhr) {
            var password = $("#password").val();
            var token = "<% session.token %>";
            $("input:password").val("");
            $("#digest").val($.md5($.md5(password + salt) + token));
            form.submit();
         }
      });
   });
</script>

<% #register %>
<h1><% response.title %></h1>
<form class='uk-form uk-form-stacked' id="register" method="post" action="<% response.action %>">
   <input type="hidden" name="hash" id="hash" />
   <div class='uk-form-row'>
      <label class='uk-form-label' for='name'>
         <% gettext Account %>
      </label>
      <div class='uk-form-controls'>
         <input type="text" name="name" id="name" maxlength=25 value="<% request.name encoding="form" %>" class=uk-width-1-2 tabindex=1 required>
      </div>
   </div>
   <div class='uk-form-row'>
      <label class='uk-form-label' for='email'>
         <% gettext e-mail %>
      </label>
      <div class='uk-form-controls'>
         <input type="email" name="email" id="email" value="<% request.email encoding="form" %>" class=uk-width-1-2 tabindex=2 required>
      </div>
   </div>
   <div class='uk-form-row'>
      <label class='uk-form-label' for='password'>
         <% gettext Password %>
      </label>
      <div class='uk-form-controls uk-form-password uk-width-1-2'>
         <input type="password" name="password" id="password" class='uk-width-1-1' required tabindex=3>
         <a href='javascript:' class='uk-form-password-toggle' data-uk-form-password="{
            lblHide: '<% gettext Hide %>',
            lblShow: '<% gettext Show %>'
         }"><% gettext Show %></a>
      </div>
   </div>
   <% if <% root.termsStory %> is null then '' else <% members.skin $Members#terms %> %>
   <% if <% root.privacyStory %> is null then '' then <% members.skin $Members#privacy %> %>
   <% param.recaptcha prefix="<div class='uk-form-row'>" suffix="</div>" %>
   <div class='uk-form-row uk-margin-top'>
      <button class='uk-button uk-button-primary' type="submit" id="submit" name="register" value="1" tabindex=6>
         <% gettext Register %>
      </button>
      <a href='<% members.href login %>' class="uk-button uk-button-link" tabindex=7><% gettext Cancel %></a>
   </div>
</form>
<script>
   $('form#register').submit(function() {
      var token = '<% session.token %>';
      var password = $('#password').val();
      $('input:password').val('');
      var hash = $.md5(password + token);
      $('#hash').val(hash);
   });
</script>

<% #terms %>
<div class='uk-form-row'>
   <label>
      <input type="checkbox" name="terms" tabindex="4" required>
      <% gettext "I understand and accept the {0}terms and conditions{1}" <% story <% root.termsStory %> url prefix='<a href="' suffix='">' %> '</a>' %>
   </label>
</div>

<% #privacy %>
<div class='uk-form-row'>
   <label>
      <input type="checkbox" name="privacy" tabindex="5" required>
      <% gettext "I understand and accept the {0}data privacy statement{1}" <% story <% root.privacyStory %> url prefix='<a href="' suffix='">' %> '</a>' %>
   </label>
</div>

<% #accept %>
<h1><% response.title %></h1>
<% gettext "We have updated our terms and conditions. Please reaffirm you understand and accept the following:" %>
<form class='uk-margin-top uk-form uk-form-stacked'  method="post" action="<% response.action %>">
   <% if <% root.termsStory %> is null then '' else <% members.skin $Members#terms %> %>
   <% if <% root.privacyStory %> is null then '' then <% members.skin $Members#privacy %> %>
   <div class='uk-form-row uk-margin-top'>
      <button class='uk-button uk-button-primary' type="submit" name="accept" value="1" tabindex=6>
         <% gettext Accept %>
      </button>
      <a href='<% site.href %>' class="uk-button uk-button-link" tabindex=7><% gettext Cancel %></a>
   </div>
</form>

<% #reset %>
<h1><% response.title %></h1>
<% gettext "Enter your username and the e-mail address you have used when you registered. You will then receive a confirmation e-mail containing further instructions." %>
<form class='uk-margin-top uk-form uk-form-stacked' id="login" method="post" action="<% response.action %>">
   <div class='uk-form-row'>
      <label class='uk-form-label' for='name'>
         <% gettext Account %>
      </label>
      <input type="text" name="name" id="name" value="<% request.name encoding="form" %>" class='uk-width-1-2' required tabindex=1>
   </div>
   <div class='uk-form-row'>
      <label class='uk-form-label' for='email'>
         <% gettext E-mail %>
      </label>
      <input type="email" name="email" id="email" value="<% request.email encoding="form" %>" class='uk-width-1-2' required tabindex=2>
   </div>
   <div class='uk-form-row uk-margin-top'>
      <button class='uk-button uk-button-primary' type="submit" id="submit" name="reset" value="1" tabindex=3><% gettext "Send Request" %></button>
      <a href='<% members.href login %>' class="uk-button uk-button-link" tabindex=4><% gettext Cancel %></a>
   </div>
</form>

<% #password %>
<h1><% response.title %></h1>
<form class='uk-form uk-form-stacked' id="login" method="post" action="<% response.action %>">
   <div class='uk-form-row'>
      <div class='uk-form-controls uk-form-password uk-width-1-2'>
         <input type="password" name="password" id="password" class='uk-width-1-1'>
         <a href='javascript:' class='uk-form-password-toggle' data-uk-form-password="{
            lblHide: '<% gettext Hide %>',
            lblShow: '<% gettext Show %>'
         }"><% gettext Show %></a>
      </div>
   </div>
   <div class='uk-form-row'>
      <button class='uk-button uk-button-primary' type="submit" id="submit" name="save" value="1" tabindex="4"><% gettext Save %></button>
      <a href='<% members.href login %>' class="uk-button uk-button-link"><% gettext Cancel %></a>
   </div>
</form>

<% #add %>
<h1><% response.title %></h1>
<form class='uk-form uk-form-stacked' method='post' action='<% response.action %>'>
   <div class='uk-form-row'>
      <div class='uk-form-label'>
         <% gettext Name %>
         <i class='uk-icon-info-circle uk-text-muted' data-uk-tooltip="{pos: 'right'}" title='<% gettext 'You can use the asterisk * as wildcard.' %>'></i>
      </div>
      <div class='uk-form-controls'>
         <input type='text' name='term' id='term' value='<% request.term encoding='form' %>' class='uk-width-1-2' required>
         <button class='uk-button uk-button-primary' type='submit' id='submit' name='Find' value='1'>
            <% gettext Find %>
         </button>
         <a href='<% members.href %>' class='uk-button uk-button-link'><% gettext Cancel %></a>
      </div>
   </div>
</form>
<p>
   <% if <% response.count %> is null then '' else <% ngettext 'Showing {0} result' 'Showing {0} results' <% response.count %> suffix=. %> %>
</p>
<% response.result %>

<% #results %>
<table class='uk-table uk-table-striped uk-table-hover uk-table-condensed'>
   <thead>
      <tr>
         <th><% gettext Account %></th>
         <th><% gettext Registered %></th>
         <!--th><% gettext Role %></th-->
         <th></th>
      </tr>
   </thead>
   <tbody>
      <% param.result %>
   </tbody>
</table>

<% #result %>
<tr>
   <td><% param.name %></td>
   <td title='<% param.created | format short %>' data-uk-tooltip="{pos: 'top-left'}"><% param.created | format text %></td>
   <td class='uk-text-right'>
      <a href='?name=<% param.name encoding=form %>'><i class='uk-icon-plus'></i></a>
   </td>
</tr>

<% #recaptcha %>
<div class='uk-margin-top g-recaptcha' data-sitekey='<% property recaptcha.sitekey %>'></div>
<script src='https://www.google.com/recaptcha/api.js?hl=<% site.locale %>'></script>
