[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Bug Tracking System.
  #
  # The Initial Developer of the Original Code is Netscape Communications
  # Corporation. Portions created by Netscape are
  # Copyright (C) 1998 Netscape Communications Corporation. All
  # Rights Reserved.
  #
  # Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
  #%]

[% PROCESS global/variables.none.tmpl %]

[%# Use the current script name. If an empty name is returned,
  # then we are accessing the home page. %]

[% login_target = cgi.url("-relative" => 1, "-query" => 1) %]
[% IF !login_target OR login_target.match("^token.cgi") %]
 [% login_target = "index.cgi" %]
[% END %]

[% login_target = basepath _ login_target %]

<li id="mini_login_container[% qs_suffix %]">
  [% connector = "?" %]
  [% IF cgi.request_method == "GET" AND cgi.query_string %]
    [% connector = "&" %]
  [% END %]
  [% script_url = login_target _ connector _ "GoAheadAndLogIn=1" %]
  <a id="login_link[% qs_suffix %]" href="[% script_url FILTER html %]"
     [% IF !use_login_page %]
     class='show_mini_login_form'
     [% END %]
     data-qs-suffix="[% qs_suffix FILTER html %]">Log In</a>

  [% IF !use_login_page %]
  <div id="mini_login[% qs_suffix FILTER html %]" class="mini-popup mini_login bz_default_hidden">
  [% Hook.process('additional_methods') %]

  <form action="[% login_target FILTER html %]" method="POST"
        data-qs-suffix="[% qs_suffix FILTER html %]">

    <input id="Bugzilla_login[% qs_suffix FILTER html %]"
           class="bz_login"
           name="Bugzilla_login"
           title="Login"
           placeholder="Email"
           aria-label="Email"
           type="email"
           required
    >
    <input class="bz_password"
           id="Bugzilla_password[% qs_suffix FILTER html %]"
           name="Bugzilla_password"
           type="password"
           title="Password"
           placeholder="Password"
           aria-label="Password"
           required
    >
    <input class="bz_password bz_default_hidden bz_mini_login_help" type="text"
           id="Bugzilla_password_dummy[% qs_suffix %]" value="password"
           title="Password"
    >
    [% IF Param('rememberlogin') == 'defaulton' ||
          Param('rememberlogin') == 'defaultoff'
    %]
      <input type="checkbox" id="Bugzilla_remember[% qs_suffix %]"
             name="Bugzilla_remember" value="on" class="bz_remember"
                 [%+ "checked" IF Param('rememberlogin') == "defaulton" %]>
      <label for="Bugzilla_remember[% qs_suffix %]">Remember</label>
    [% END %]
    <input type="hidden" name="Bugzilla_login_token"
           value="[% get_login_request_token() FILTER html %]">
    <input type="submit" name="GoAheadAndLogIn" value="Log in"
           class="check_mini_login_fields"
            id="log_in[% qs_suffix %]">
    <a href="#" id="hide_mini_login[% qs_suffix FILTER html %]" aria-label="Close"
       class="close-button hide_mini_login_form" data-qs-suffix="[% qs_suffix FILTER html %]">
      <span class="icon" aria-hidden="true"></span>
    </a>
  </form>
  </div>
  [% END %]
</li>
[% IF !use_login_page %]
<li id="forgot_container[% qs_suffix %]">
  <a id="forgot_link[% qs_suffix %]" href="[% script_url FILTER html %]#forgot"
     class='show_forgot_form'
     data-qs-suffix="[% qs_suffix FILTER html %]">Forgot Password</a>
  <div id="forgot_form[% qs_suffix %]" class="mini-popup mini_forgot bz_default_hidden">
  <form action="[% basepath FILTER none %]token.cgi" method="post">
    <input type="email" name="loginname" size="20" placeholder="Email" aria-label="Email" required>
    <input id="forgot_button[% qs_suffix %]" value="Reset Password"
           type="submit">
    <input type="hidden" name="a" value="reqpw">
    <input type="hidden" id="token[% qs_suffix FILTER html %]" name="token" value="[% issue_hash_token(['reqpw']) FILTER html %]">
    <a href="#" class="close-button hide_forgot_form" aria-label="Close" data-qs-suffix="[% qs_suffix FILTER html %]">
      <span class="icon" aria-hidden="true"></span>
    </a>
  </form>
  </div>
</li>
[% END %]
