doctype html
html(lang="en")
  head
    include head
    +head()
  body
    #wrap
      nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
        include nav
        +navheader()
        #nav-collapsible.collapse.navbar-collapse
          ul.nav.navbar-nav
            +navdefaultlinks("/login")
          if loggedIn
            +navlogoutform("/")
      section#mainpage.container
        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
    include footer
    +footer()
