mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-12 00:55:12 +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:
@@ -267,6 +267,7 @@ func (l *Login) getBaseData(r *http.Request, authReq *model.AuthRequest, title s
|
||||
Theme: l.getTheme(r),
|
||||
ThemeMode: l.getThemeMode(r),
|
||||
OrgID: l.getOrgID(authReq),
|
||||
OrgName: l.getOrgName(authReq),
|
||||
AuthReqID: getRequestID(authReq, r),
|
||||
CSRF: csrf.TemplateField(r),
|
||||
Nonce: http_mw.GetNonce(r),
|
||||
@@ -312,20 +313,17 @@ func (l *Login) getOrgID(authReq *model.AuthRequest) string {
|
||||
if authReq == nil {
|
||||
return ""
|
||||
}
|
||||
if authReq.UserOrgID != "" {
|
||||
return authReq.UserOrgID
|
||||
if authReq.RequestedOrgID != "" {
|
||||
return authReq.RequestedOrgID
|
||||
}
|
||||
if authReq.Request == nil {
|
||||
return authReq.UserOrgID
|
||||
}
|
||||
|
||||
func (l *Login) getOrgName(authReq *model.AuthRequest) string {
|
||||
if authReq == nil {
|
||||
return ""
|
||||
}
|
||||
primaryDomain := authReq.GetScopeOrgPrimaryDomain()
|
||||
if primaryDomain != "" {
|
||||
org, _ := l.authRepo.GetOrgByPrimaryDomain(primaryDomain)
|
||||
if org != nil {
|
||||
return org.ID
|
||||
}
|
||||
}
|
||||
return ""
|
||||
return authReq.RequestedOrgName
|
||||
}
|
||||
|
||||
func getRequestID(authReq *model.AuthRequest, r *http.Request) string {
|
||||
@@ -355,6 +353,7 @@ type baseData struct {
|
||||
Theme string
|
||||
ThemeMode string
|
||||
OrgID string
|
||||
OrgName string
|
||||
AuthReqID string
|
||||
CSRF template.HTML
|
||||
Nonce string
|
||||
|
||||
Reference in New Issue
Block a user