diff --git a/pkg/api/index.go b/pkg/api/index.go index 7832bbdd29e..e88d1e00318 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -30,11 +30,15 @@ func getProfileNode(c *models.ReqContext) *dtos.NavLink { { Text: "Preferences", Id: "profile-settings", Url: setting.AppSubUrl + "/profile", Icon: "sliders-v-alt", }, - { + } + + if setting.AddChangePasswordLink() { + children = append(children, &dtos.NavLink{ Text: "Change Password", Id: "change-password", Url: setting.AppSubUrl + "/profile/password", Icon: "lock", HideFromMenu: true, - }, + }) } + if !setting.DisableSignoutMenu { // add sign out first children = append(children, &dtos.NavLink{ diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 1a83ebf4379..09eba061858 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -207,6 +207,12 @@ var ( ImageUploadProvider string ) +// AddChangePasswordLink returns if login form is disabled or not since +// the same intention can be used to hide both features. +func AddChangePasswordLink() bool { + return !DisableLoginForm +} + // TODO move all global vars to this struct type Cfg struct { Raw *ini.File