@**
 * Copyright (C) 2018 Kaj Magnus Lindberg
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *@

@(tpi: debiki.SiteTpi, xsrfToken: String, isDefaultSite: Boolean)


@css = @{("""
input[type="text"] {
  width: 440px;
  max-width: 90%;
  padding: 5px;
}
""")}


@* For now only, use `createsite.main`. [8KABRP02] *@
@views.html.createsite.main(tpi, css = css) {

<h1>Admin extra login</h1>

<div class='row'>
<div class="col-sm-12">
  <br>
  <p>Type your admin email address, and you'll be emailed a one time login link,
      via which you can login as admin.
  </p>

  <form action="@controllers.routes.AdminController.handleAdminOneTimeLoginForm"
    class="form" autocomplete="off" method="POST">

  <input name='dw-fi-xsrf' type='hidden' value='@xsrfToken'>
  <input type="text" name="emailAddress" value="" class="e_AdmEmI"><br>

  <br>
  <button type="submit" class="btn btn-default e_SbmB">Submit</button>
</form>
</div>
</div>

@* If seems self hosted ( = isDefaultSite for now), then, show this so the
admin knows what to do, if hen hasn't configured emails.  [GETADMLNK] *@
@if(isDefaultSite) {
<br>
<br>
<div class='row'>
<div class="col-sm-12">
  <p>
    If you haven't configured emails yet, you can still read the email I'll
    try to send, by logging in to the server, and running these commands:<br>
    <pre>sudo -i
cd /opt/talkyard/
./scripts/find-admin-login-link.sh
</pre>
  </p>
</div>
</div>
}

}

