Use base url to generate template links/redirects

This commit is contained in:
2022-08-02 11:48:42 +02:00
parent 5beae19d21
commit d786d3a26f
7 changed files with 29 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import (
"net/http"
oidc "forge.cadoles.com/wpetit/goweb-oidc"
"forge.cadoles.com/wpetit/goweb-oidc/internal/config"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/logger"
"gitlab.com/wpetit/goweb/middleware/container"
@ -27,7 +28,10 @@ func handleLoginCallback(w http.ResponseWriter, r *http.Request) {
return
}
ctn := container.Must(ctx)
conf := config.Must(ctn)
logger.Info(ctx, "user logged in", logger.F("sub", idToken.Subject))
http.Redirect(w, r, "/", http.StatusSeeOther)
http.Redirect(w, r, conf.HTTP.PublicBaseURL+"/", http.StatusSeeOther)
}