瀏覽代碼

Merge branch 'ldap_login_hints' of https://github.com/tmonk42/grafana into tmonk42-ldap_login_hints

Conflicts:
	conf/defaults.ini
	pkg/setting/setting.go

closes #2571
closes #2494
carl bergquist 10 年之前
父節點
當前提交
fab1062c0b
共有 6 個文件被更改,包括 11 次插入1 次删除
  1. 3 0
      conf/defaults.ini
  2. 3 0
      conf/sample.ini
  3. 1 0
      pkg/api/login.go
  4. 2 0
      pkg/setting/setting.go
  5. 1 0
      public/app/core/controllers/login_ctrl.js
  6. 1 1
      public/app/partials/login.html

+ 3 - 0
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

+ 3 - 0
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

+ 1 - 0
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)

+ 2 - 0
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)

+ 1 - 0
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';

+ 1 - 1
public/app/partials/login.html

@@ -24,7 +24,7 @@
 								<strong>User</strong>
 							</li>
 							<li>
-								<input type="text" name="username" class="tight-form-input last" required ng-model='formModel.user' placeholder="email or username" style="width: 253px">
+								<input type="text" name="username" class="tight-form-input last" required ng-model='formModel.user' placeholder={{loginHint}} style="width: 253px">
 							</li>
 						</ul>
 						<div class="clearfix"></div>