Sfoglia il codice sorgente

Login: only enabled oauth options are now shown on login page

Torkel Ödegaard 11 anni fa
parent
commit
017eab8dcd

+ 1 - 6
src/app/components/settings.js

@@ -34,12 +34,7 @@ function (_, crypto) {
       }
     };
 
-    // This initializes a new hash on purpose, to avoid adding parameters to
-    // config.js without providing sane defaults
-    var settings = {};
-    _.each(defaults, function(value, key) {
-      settings[key] = typeof options[key] !== 'undefined' ? options[key]  : defaults[key];
-    });
+    var settings = _.extend(options, defaults);
 
     var parseBasicAuth = function(datasource) {
       var passwordEnd = datasource.url.indexOf('@');

+ 4 - 0
src/app/controllers/loginCtrl.js

@@ -16,6 +16,10 @@ function (angular, config) {
     };
 
     $scope.grafana.sidemenu = false;
+
+    $scope.googleAuthEnabled = config.googleAuthEnabled;
+    $scope.githubAuthEnabled = config.githubAuthEnabled;
+
     $scope.loginMode = true;
     $scope.submitBtnClass = 'btn-inverse';
     $scope.submitBtnText = 'Log in';

+ 2 - 2
src/app/partials/login.html

@@ -80,11 +80,11 @@
 			<div class="clearfix"></div>
 
 			<div class="login-oauth text-center">
-				<a class="btn btn-google" href="login/google" target="_self">
+				<a class="btn btn-google" href="login/google" target="_self" ng-if="googleAuthEnabled">
 					<i class="fa fa-google"></i>
 					with Google
 				</a>
-				<a class="btn btn-github" href="login/github" target="_self">
+				<a class="btn btn-github" href="login/github" target="_self" ng-if="githubAuthEnabled">
 					<i class="fa fa-github"></i>
 					with Github
 				</a>