login_show.go 673 B

1234567891011121314151617181920212223242526
  1. // Copyright 2017 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui // import "miniflux.app/ui"
  5. import (
  6. "net/http"
  7. "miniflux.app/http/response/html"
  8. "miniflux.app/http/request"
  9. "miniflux.app/http/route"
  10. "miniflux.app/ui/session"
  11. "miniflux.app/ui/view"
  12. )
  13. func (h *handler) showLoginPage(w http.ResponseWriter, r *http.Request) {
  14. if request.IsAuthenticated(r) {
  15. html.Redirect(w, r, route.Path(h.router, "unread"))
  16. return
  17. }
  18. sess := session.New(h.store, request.SessionID(r))
  19. view := view.New(h.tpl, r, sess)
  20. html.OK(w, r, view.Render("login"))
  21. }