From 235bbc9c7ed8fa28294a23e33143a6b288d9a7ad Mon Sep 17 00:00:00 2001 From: "Haneysmith, Nathan" Date: Thu, 20 Aug 2015 11:15:36 -0700 Subject: [PATCH 1/2] custom login hints via config file --- conf/sample.ini | 3 +++ pkg/api/login.go | 1 + pkg/setting/setting.go | 2 ++ public/app/controllers/loginCtrl.js | 1 + public/app/partials/login.html | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/conf/sample.ini b/conf/sample.ini index 9a8d9aa3908..e8122766e9f 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -130,6 +130,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 3ac4b16db64..907d12479d8 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -79,6 +79,7 @@ var ( AllowUserOrgCreate bool AutoAssignOrg bool AutoAssignOrgRole string + LoginHint string // Http auth AdminUser string @@ -392,6 +393,7 @@ func NewConfigContext(args *CommandLineArgs) { AllowUserOrgCreate = users.Key("allow_org_create").MustBool(true) AutoAssignOrg = users.Key("auto_assign_org").MustBool(true) AutoAssignOrgRole = users.Key("auto_assign_org_role").In("Editor", []string{"Editor", "Admin", "Read Only Editor", "Viewer"}) + LoginHint = users.Key("login_hint").String() // anonymous access AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false) diff --git a/public/app/controllers/loginCtrl.js b/public/app/controllers/loginCtrl.js index 40e8009b399..9d27687c5ba 100644 --- a/public/app/controllers/loginCtrl.js +++ b/public/app/controllers/loginCtrl.js @@ -19,6 +19,7 @@ function (angular, 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 f311c929b66..aaff2f6fd53 100644 --- a/public/app/partials/login.html +++ b/public/app/partials/login.html @@ -26,7 +26,7 @@ User
  • - +
  • From 74ea26615734776f091e42433204ddb1ff52fc69 Mon Sep 17 00:00:00 2001 From: "Haneysmith, Nathan" Date: Thu, 20 Aug 2015 11:20:40 -0700 Subject: [PATCH 2/2] add login hint to defaults.ini --- conf/defaults.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf/defaults.ini b/conf/defaults.ini index 7ca5191c4e7..39899efb9ff 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -131,6 +131,9 @@ auto_assign_org = true # Default role new users will be automatically assigned (if auto_assign_org 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