mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: fix issue that application theme is ignored in appendThemeCookie() (#3506)
This commit is contained in:
parent
c699e35e6b
commit
2b89f6b37b
@ -25,10 +25,20 @@ import (
|
||||
|
||||
func appendThemeCookie(ctx *context.Context, urlPath string) error {
|
||||
if urlPath == "/login" {
|
||||
organization, err := object.GetOrganization(fmt.Sprintf("admin/built-in"))
|
||||
application, err := object.GetDefaultApplication(fmt.Sprintf("admin/built-in"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if application.ThemeData != nil {
|
||||
return setThemeDataCookie(ctx, application.ThemeData)
|
||||
}
|
||||
organization := application.OrganizationObj
|
||||
if organization == nil {
|
||||
organization, err = object.GetOrganization(fmt.Sprintf("admin/built-in"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if organization != nil {
|
||||
return setThemeDataCookie(ctx, organization.ThemeData)
|
||||
}
|
||||
@ -46,6 +56,9 @@ func appendThemeCookie(ctx *context.Context, urlPath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if application.ThemeData != nil {
|
||||
return setThemeDataCookie(ctx, application.ThemeData)
|
||||
}
|
||||
if organization != nil {
|
||||
return setThemeDataCookie(ctx, organization.ThemeData)
|
||||
}
|
||||
@ -53,10 +66,20 @@ func appendThemeCookie(ctx *context.Context, urlPath string) error {
|
||||
} else if strings.HasPrefix(urlPath, "/login/") {
|
||||
owner := strings.Replace(urlPath, "/login/", "", -1)
|
||||
if owner != "undefined" && owner != "oauth/undefined" {
|
||||
organization, err := object.GetOrganization(fmt.Sprintf("admin/%s", owner))
|
||||
application, err := object.GetDefaultApplication(fmt.Sprintf("admin/%s", owner))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if application.ThemeData != nil {
|
||||
return setThemeDataCookie(ctx, application.ThemeData)
|
||||
}
|
||||
organization := application.OrganizationObj
|
||||
if organization == nil {
|
||||
organization, err = object.GetOrganization(fmt.Sprintf("admin/%s", owner))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if organization != nil {
|
||||
return setThemeDataCookie(ctx, organization.ThemeData)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user