auth: Improve login parts

This commit is contained in:
Tom Wiesing 2022-12-25 11:54:16 +01:00
parent 1af9d0d83f
commit 515142c055
No known key found for this signature in database
13 changed files with 382 additions and 101 deletions

View file

@ -0,0 +1,24 @@
package auth
import (
"context"
_ "embed"
"net/http"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/control/static"
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
)
//go:embed "templates/home.html"
var homeHTMLStr string
var homeTemplate = static.AssetsAuthHome.MustParseShared(
"home.html",
homeHTMLStr,
)
func (auth *Auth) authHome(ctx context.Context) http.Handler {
return auth.Protect(&httpx.HTMLHandler[*AuthUser]{
Handler: auth.UserOf,
Template: homeTemplate,
}, nil)
}