mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-09 23:55:12 +00:00
feat: run on a single port (#3163)
* start v2 * start * run * some cleanup * remove v2 pkg again * simplify * webauthn * remove unused config * fix login path in Dockerfile * fix asset_generator.go * health handler * fix grpc web * refactor * merge * build new main.go * run new main.go * update logging pkg * fix error msg * update logging * cleanup * cleanup * go mod tidy * change localDevMode * fix customEndpoints * update logging * comments * change local flag to external configs * fix location generated go code * fix Co-authored-by: fforootd <[email protected]>
This commit is contained in:
co-authored by
fforootd
parent
2f3a482ade
commit
389eb4a27a
@@ -0,0 +1,47 @@
|
||||
package login
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
|
||||
http_mw "github.com/caos/zitadel/internal/api/http/middleware"
|
||||
)
|
||||
|
||||
const (
|
||||
tmplUserSelection = "userselection"
|
||||
)
|
||||
|
||||
type userSelectionFormData struct {
|
||||
UserID string `schema:"userID"`
|
||||
}
|
||||
|
||||
func (l *Login) renderUserSelection(w http.ResponseWriter, r *http.Request, authReq *domain.AuthRequest, selectionData *domain.SelectUserStep) {
|
||||
data := userSelectionData{
|
||||
baseData: l.getBaseData(r, authReq, "Select User", "", ""),
|
||||
Users: selectionData.Users,
|
||||
Linking: len(authReq.LinkingUsers) > 0,
|
||||
}
|
||||
translator := l.getTranslator(authReq)
|
||||
l.renderer.RenderTemplate(w, r, translator, l.renderer.Templates[tmplUserSelection], data, nil)
|
||||
}
|
||||
|
||||
func (l *Login) handleSelectUser(w http.ResponseWriter, r *http.Request) {
|
||||
data := new(userSelectionFormData)
|
||||
authSession, err := l.getAuthRequestAndParseData(r, data)
|
||||
if err != nil {
|
||||
l.renderError(w, r, authSession, err)
|
||||
return
|
||||
}
|
||||
if data.UserID == "0" {
|
||||
l.renderLogin(w, r, authSession, nil)
|
||||
return
|
||||
}
|
||||
userAgentID, _ := http_mw.UserAgentIDFromCtx(r.Context())
|
||||
err = l.authRepo.SelectUser(r.Context(), authSession.ID, data.UserID, userAgentID)
|
||||
if err != nil {
|
||||
l.renderError(w, r, authSession, err)
|
||||
return
|
||||
}
|
||||
l.renderNextStep(w, r, authSession)
|
||||
}
|
||||
Reference in New Issue
Block a user