Explorar el Código

feat(config): changed name of allow_user_login_pass to disable_login_form, changed the section of the config option to [auth], impacts merged PR #5423

Torkel Ödegaard hace 9 años
padre
commit
2750c8a801

+ 3 - 2
conf/defaults.ini

@@ -190,8 +190,9 @@ login_hint = email or username
 # Default UI theme ("dark" or "light")
 default_theme = dark
 
-# Allow users to sign in using username and password
-allow_user_pass_login = true
+[auth]
+# Set to true to disable (hide) the login form, useful if you use OAuth
+disable_login_form = false
 
 #################################### Anonymous Auth ######################
 [auth.anonymous]

+ 4 - 0
conf/sample.ini

@@ -175,6 +175,10 @@
 # Default UI theme ("dark" or "light")
 ;default_theme = dark
 
+[auth]
+# Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false
+;disable_login_form = false
+
 #################################### Anonymous Auth ##########################
 [auth.anonymous]
 # enable anonymous access

+ 8 - 0
docs/sources/installation/configuration.md

@@ -238,6 +238,14 @@ options are `Admin` and `Editor` and `Read-Only Editor`.
 
 <hr>
 
+## [auth]
+
+### disable_login_form
+
+Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false.
+
+<hr>
+
 ## [auth.anonymous]
 
 ### enabled

+ 1 - 1
pkg/api/login.go

@@ -33,7 +33,7 @@ func LoginView(c *middleware.Context) {
 	viewData.Settings["oauth"] = enabledOAuths
 	viewData.Settings["disableUserSignUp"] = !setting.AllowUserSignUp
 	viewData.Settings["loginHint"] = setting.LoginHint
-	viewData.Settings["allowUserPassLogin"] = setting.AllowUserPassLogin
+	viewData.Settings["disableLoginForm"] = setting.DisableLoginForm
 
 	if !tryLoginUsingRememberCookie(c) {
 		c.HTML(200, VIEW_INDEX, viewData)

+ 5 - 2
pkg/setting/setting.go

@@ -92,7 +92,7 @@ var (
 	VerifyEmailEnabled bool
 	LoginHint          string
 	DefaultTheme       string
-	AllowUserPassLogin bool
+	DisableLoginForm   bool
 
 	// Http auth
 	AdminUser     string
@@ -519,7 +519,10 @@ func NewConfigContext(args *CommandLineArgs) error {
 	VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false)
 	LoginHint = users.Key("login_hint").String()
 	DefaultTheme = users.Key("default_theme").String()
-	AllowUserPassLogin = users.Key("allow_user_pass_login").MustBool(true)
+
+	// auth
+	auth := Cfg.Section("auth")
+	DisableLoginForm = auth.Key("disable_login_form").MustBool(false)
 
 	// anonymous access
 	AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false)

+ 1 - 1
public/app/core/controllers/login_ctrl.js

@@ -25,7 +25,7 @@ function (angular, _, coreModule, config) {
     $scope.oauth = config.oauth;
     $scope.oauthEnabled = _.keys(config.oauth).length > 0;
 
-    $scope.allowUserPassLogin = config.allowUserPassLogin;
+    $scope.disableLoginForm = config.disableLoginForm;
     $scope.disableUserSignUp = config.disableUserSignUp;
     $scope.loginHint     = config.loginHint;
 

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

@@ -17,7 +17,7 @@
 				</button>
 			</div>
 
-      <form name="loginForm" class="login-form gf-form-group" ng-show="allowUserPassLogin">
+      <form name="loginForm" class="login-form gf-form-group" ng-hide="disableLoginForm">
 				<div class="gf-form" ng-if="loginMode">
 					<span class="gf-form-label width-7">User</span>
 					<input type="text" name="username" class="gf-form-input max-width-14" required ng-model='formModel.user' placeholder={{loginHint}}>
@@ -40,7 +40,7 @@
 			</form>
 
 			<div ng-if="loginMode">
-				<div class="text-center login-divider" ng-show="oauthEnabled && allowUserPassLogin">
+				<div class="text-center login-divider" ng-show="oauthEnabled && !disableLoginForm">
 					<div class="login-divider-line">
 						<span class="login-divider-text">
 							Or login with
@@ -71,7 +71,7 @@
 
 			<div class="clearfix"></div>
 
-			<div class="text-center password-recovery" ng-show="allowUserPassLogin">
+			<div class="text-center password-recovery" ng-hide="disableLoginForm">
 				<div class="text-center">
 					<a href="user/password/send-reset-email">
 						Forgot your password?