extends layout.pug

block content
  if wasAlreadyLoggedIn
    .col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
      .alert.alert-info.messagebox.center
        h3(style="margin: 5px auto") Logged in as #{loginName}
  else if !loggedIn
    .col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
      if loginError
        .alert.alert-danger.messagebox.center
          strong Login Failed
          p= loginError
      h2 Login
      form(role="form", action="/login", method="post")
        input(type="hidden", name="_csrf", value=csrfToken)
        if redirect
          input(type="hidden", name="dest", value=redirect)
        .form-group
          label(for="username") Username
          input#username.form-control(type="text", name="name")
        .form-group
          label(for="password") Password
          input#password.form-control(type="password", name="password")
          a(href="/account/passwordreset") Forgot password?
        .form-group
          .checkbox
            label
              input(type="checkbox", name="remember")
              | Remember me
        button.btn.btn-success.btn-block(type="submit") Login
  else
    .col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
      .alert.alert-success.messagebox.center
        strong Login Successful
        p Logged in as #{loginName}
          if redirect
            br
            a(href=redirect) Return to previous page
