Commit c2689b0c by bergquist

Merge branch 'kfitzpatrick-recreate-4675'

parents 23345c56 690a74c6
...@@ -178,6 +178,9 @@ login_hint = email or username ...@@ -178,6 +178,9 @@ login_hint = email or username
# Default UI theme ("dark" or "light") # Default UI theme ("dark" or "light")
default_theme = dark default_theme = dark
# Allow users to sign in using username and password
allow_user_pass_login = true
#################################### Anonymous Auth ########################## #################################### Anonymous Auth ##########################
[auth.anonymous] [auth.anonymous]
# enable anonymous access # enable anonymous access
......
...@@ -29,6 +29,7 @@ func LoginView(c *middleware.Context) { ...@@ -29,6 +29,7 @@ func LoginView(c *middleware.Context) {
viewData.Settings["githubAuthEnabled"] = setting.OAuthService.GitHub viewData.Settings["githubAuthEnabled"] = setting.OAuthService.GitHub
viewData.Settings["disableUserSignUp"] = !setting.AllowUserSignUp viewData.Settings["disableUserSignUp"] = !setting.AllowUserSignUp
viewData.Settings["loginHint"] = setting.LoginHint viewData.Settings["loginHint"] = setting.LoginHint
viewData.Settings["allowUserPassLogin"] = setting.AllowUserPassLogin
if !tryLoginUsingRememberCookie(c) { if !tryLoginUsingRememberCookie(c) {
c.HTML(200, VIEW_INDEX, viewData) c.HTML(200, VIEW_INDEX, viewData)
......
...@@ -89,6 +89,7 @@ var ( ...@@ -89,6 +89,7 @@ var (
VerifyEmailEnabled bool VerifyEmailEnabled bool
LoginHint string LoginHint string
DefaultTheme string DefaultTheme string
AllowUserPassLogin bool
// Http auth // Http auth
AdminUser string AdminUser string
...@@ -485,6 +486,7 @@ func NewConfigContext(args *CommandLineArgs) error { ...@@ -485,6 +486,7 @@ func NewConfigContext(args *CommandLineArgs) error {
VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false) VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false)
LoginHint = users.Key("login_hint").String() LoginHint = users.Key("login_hint").String()
DefaultTheme = users.Key("default_theme").String() DefaultTheme = users.Key("default_theme").String()
AllowUserPassLogin = users.Key("allow_user_pass_login").MustBool(true)
// anonymous access // anonymous access
AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false) AnonymousEnabled = Cfg.Section("auth.anonymous").Key("enabled").MustBool(false)
......
...@@ -18,6 +18,7 @@ function (angular, coreModule, config) { ...@@ -18,6 +18,7 @@ function (angular, coreModule, config) {
$scope.googleAuthEnabled = config.googleAuthEnabled; $scope.googleAuthEnabled = config.googleAuthEnabled;
$scope.githubAuthEnabled = config.githubAuthEnabled; $scope.githubAuthEnabled = config.githubAuthEnabled;
$scope.oauthEnabled = config.githubAuthEnabled || config.googleAuthEnabled; $scope.oauthEnabled = config.githubAuthEnabled || config.googleAuthEnabled;
$scope.allowUserPassLogin = config.allowUserPassLogin;
$scope.disableUserSignUp = config.disableUserSignUp; $scope.disableUserSignUp = config.disableUserSignUp;
$scope.loginHint = config.loginHint; $scope.loginHint = config.loginHint;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</button> </button>
</div> </div>
<form name="loginForm" class="login-form gf-form-group"> <form name="loginForm" class="login-form gf-form-group" ng-if="allowUserPassLogin">
<div class="gf-form" ng-if="loginMode"> <div class="gf-form" ng-if="loginMode">
<span class="gf-form-label width-7">User</span> <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}}> <input type="text" name="username" class="gf-form-input max-width-14" required ng-model='formModel.user' placeholder={{loginHint}}>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</form> </form>
<div ng-if="loginMode"> <div ng-if="loginMode">
<div class="text-center login-divider" ng-if="oauthEnabled"> <div class="text-center login-divider" ng-if="oauthEnabled && allowUserPassLogin">
<div class="login-divider-line"> <div class="login-divider-line">
<span class="login-divider-text"> <span class="login-divider-text">
Or login with Or login with
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="text-center password-recovery"> <div class="text-center password-recovery" ng-if="allowUserPassLogin">
<div class="text-center"> <div class="text-center">
<a href="user/password/send-reset-email"> <a href="user/password/send-reset-email">
Forgot your password? Forgot your password?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment