{{#login-modal screenX=lastX screenY=lastY loginName=loginName loginPassword=loginPassword secondFactorToken=secondFactorToken action=(action "login")}}
  {{plugin-outlet name="login-before-modal-body" tagName=""}}
  {{#d-modal-body title="login.title" class=modalBodyClasses}}
    {{#if showLoginButtons}}
      {{login-buttons
        showLoginWithEmailLink=showLoginWithEmailLink
        processingEmailLink=processingEmailLink
        emailLogin=(action "emailLogin")
        externalLogin=(action "externalLogin")}}
    {{/if}}

    {{#if canLoginLocal}}
      <form id='login-form' method='post'>
        <div id="credentials" class={{credentialsClass}}>
          <table>
            <tbody>
              <tr>
                <td>
                  <label for='login-account-name'>{{i18n 'login.username'}}</label>
                </td>
                <td>
                  {{text-field value=loginName type="email" placeholderKey="login.email_placeholder" id="login-account-name" autocorrect="off" autocapitalize="off" disabled=showSecondFactor}}
                </td>
              </tr>
              <tr>
                <td>
                  <label for='login-account-password'>{{i18n 'login.password'}}</label>
                </td>
                <td>
                  {{text-field value=loginPassword type="password" id="login-account-password" maxlength="200" disabled=showSecondFactor}}
                </td>
              </tr>
              <tr>
                <td></td>
                <td>
                  <a href id="forgot-password-link" {{action "showForgotPassword"}}>{{i18n 'forgot_password.action'}}</a>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        {{#second-factor-form
          secondFactorMethod=secondFactorMethod
          secondFactorToken=secondFactorToken
          class=secondFactorClass
          backupEnabled=backupEnabled
          isLogin=true}}
          {{#if showSecurityKey}}
            {{#security-key-form
              allowedCredentialIds=securityKeyAllowedCredentialIds
              challenge=securityKeyChallenge
              showSecurityKey=showSecurityKey
              showSecondFactor=showSecondFactor
              secondFactorMethod=secondFactorMethod
              otherMethodAllowed=otherMethodAllowed
              action=(action "authenticateSecurityKey")}}
            {{/security-key-form}}
          {{else}}
            {{second-factor-input value=secondFactorToken inputId='login-second-factor' secondFactorMethod=secondFactorMethod backupEnabled=backupEnabled}}
          {{/if}}
        {{/second-factor-form}}
      </form>
    {{/if}}

  {{/d-modal-body}}

  <div class="modal-footer">
    {{#if canLoginLocal}}
      {{#unless showSecurityKey }}
        {{d-button action=(action "login")
          icon="unlock"
          label=loginButtonLabel
          disabled=loginDisabled
          class="btn-large btn-primary"}}
      {{/unless}}

      {{#if showSignupLink}}
        {{#d-button class="btn-large" id="new-account-link" action=(route-action "showCreateAccount")}}
          {{i18n "create_account.title"}}
        {{/d-button}}
      {{/if}}
    {{/if}}
  </div>

  {{plugin-outlet name="login-after-modal-footer" tagName=""}}

  <div id='login-alert' class={{alertClass}}>{{alert}}</div>
{{/login-modal}}
