diff --git a/conf/defaults.ini b/conf/defaults.ini index 01402103b07..3350954a150 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -142,6 +142,9 @@ auto_assign_org_role = Viewer # Require email validation before sign up completes verify_email_enabled = false +# Background text for the user field on the login page +login_hint = email or username + #################################### Anonymous Auth ########################## [auth.anonymous] # enable anonymous access diff --git a/conf/sample.ini b/conf/sample.ini index e8550c66c1a..df092cda5ed 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -134,6 +134,9 @@ # Default role new users will be automatically assigned (if disabled above is set to true) ;auto_assign_org_role = Viewer +# Background text for the user field on the login page +;login_hint = email or username + #################################### Anonymous Auth ########################## [auth.anonymous] # enable anonymous access diff --git a/pkg/api/login.go b/pkg/api/login.go index 8863e1b10c1..d691270ad72 100644 --- a/pkg/api/login.go +++ b/pkg/api/login.go @@ -28,6 +28,7 @@ func LoginView(c *middleware.Context) { settings["googleAuthEnabled"] = setting.OAuthService.Google settings["githubAuthEnabled"] = setting.OAuthService.GitHub settings["disableUserSignUp"] = !setting.AllowUserSignUp + settings["loginHint"] = setting.LoginHint if !tryLoginUsingRememberCookie(c) { c.HTML(200, VIEW_INDEX) diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index ac465e294ea..f59333f8426 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -82,6 +82,7 @@ var ( AutoAssignOrg bool AutoAssignOrgRole string VerifyEmailEnabled bool + LoginHint string // Http auth AdminUser string @@ -436,6 +437,7 @@ func NewConfigContext(args *CommandLineArgs) error { AutoAssignOrg = users.Key("auto_assign_org").MustBool(true) AutoAssignOrgRole = users.Key("auto_assign_org_role").In("Editor", []string{"Editor", "Admin", "Read Only Editor", "Viewer"}) VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false) + LoginHint = users.Key("login_hint").String() // anonymous access AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false) diff --git a/public/app/core/controllers/login_ctrl.js b/public/app/core/controllers/login_ctrl.js index 22cb2c6f04b..df58112e871 100644 --- a/public/app/core/controllers/login_ctrl.js +++ b/public/app/core/controllers/login_ctrl.js @@ -18,6 +18,7 @@ function (angular, coreModule, config) { $scope.googleAuthEnabled = config.googleAuthEnabled; $scope.githubAuthEnabled = config.githubAuthEnabled; $scope.disableUserSignUp = config.disableUserSignUp; + $scope.loginHint = config.loginHint; $scope.loginMode = true; $scope.submitBtnText = 'Log in'; diff --git a/public/app/partials/login.html b/public/app/partials/login.html index 630f295ecd3..98ed0899316 100644 --- a/public/app/partials/login.html +++ b/public/app/partials/login.html @@ -24,7 +24,7 @@ User