mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-05 22:02:15 +00:00
fix: primary domain claim (#1082)
* fix: primary domain scope (overwrite by roles and rogue `:`) * disable wrong users * fix test * show requested org name * only show domain when selected
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"golang.org/x/text/language"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/caos/zitadel/internal/auth_request/model"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/models"
|
||||
@@ -71,17 +72,9 @@ func (l *Login) handleRegisterCheck(w http.ResponseWriter, r *http.Request) {
|
||||
ObjectRoot: models.ObjectRoot{AggregateID: iam.GlobalOrgID},
|
||||
Roles: []string{orgProjectCreatorRole},
|
||||
}
|
||||
if authRequest.GetScopeOrgPrimaryDomain() != "" {
|
||||
primaryDomain := authRequest.GetScopeOrgPrimaryDomain()
|
||||
org, err := l.authRepo.GetOrgByPrimaryDomain(primaryDomain)
|
||||
if err != nil {
|
||||
l.renderRegisterOption(w, r, authRequest, err)
|
||||
return
|
||||
}
|
||||
if org.ID != iam.GlobalOrgID {
|
||||
member = nil
|
||||
resourceOwner = org.ID
|
||||
}
|
||||
if authRequest.RequestedOrgID != "" && authRequest.RequestedOrgID != iam.GlobalOrgID {
|
||||
member = nil
|
||||
resourceOwner = authRequest.RequestedOrgID
|
||||
}
|
||||
user, err := l.authRepo.Register(setContext(r.Context(), resourceOwner), data.toUserModel(), member, resourceOwner)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user