grafana 298 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. commit 017eab8dcd182b8c19f65657fc3d46e30545b7ff
  2. Author: Torkel Ödegaard <torkel.odegaard@gmail.com>
  3. Date: Wed Jan 28 10:25:53 2015 +0100
  4. Login: only enabled oauth options are now shown on login page
  5. diff --git a/src/app/components/settings.js b/src/app/components/settings.js
  6. index 9bef2757d..3be2292e1 100644
  7. --- a/src/app/components/settings.js
  8. +++ b/src/app/components/settings.js
  9. @@ -34,12 +34,7 @@ function (_, crypto) {
  10. }
  11. };
  12. - // This initializes a new hash on purpose, to avoid adding parameters to
  13. - // config.js without providing sane defaults
  14. - var settings = {};
  15. - _.each(defaults, function(value, key) {
  16. - settings[key] = typeof options[key] !== 'undefined' ? options[key] : defaults[key];
  17. - });
  18. + var settings = _.extend(options, defaults);
  19. var parseBasicAuth = function(datasource) {
  20. var passwordEnd = datasource.url.indexOf('@');
  21. diff --git a/src/app/controllers/loginCtrl.js b/src/app/controllers/loginCtrl.js
  22. index c3696d551..e6b0f99f8 100644
  23. --- a/src/app/controllers/loginCtrl.js
  24. +++ b/src/app/controllers/loginCtrl.js
  25. @@ -16,6 +16,10 @@ function (angular, config) {
  26. };
  27. $scope.grafana.sidemenu = false;
  28. +
  29. + $scope.googleAuthEnabled = config.googleAuthEnabled;
  30. + $scope.githubAuthEnabled = config.githubAuthEnabled;
  31. +
  32. $scope.loginMode = true;
  33. $scope.submitBtnClass = 'btn-inverse';
  34. $scope.submitBtnText = 'Log in';
  35. diff --git a/src/app/partials/login.html b/src/app/partials/login.html
  36. index d96b4d1f9..e57cb2531 100644
  37. --- a/src/app/partials/login.html
  38. +++ b/src/app/partials/login.html
  39. @@ -80,11 +80,11 @@
  40. <div class="clearfix"></div>
  41. <div class="login-oauth text-center">
  42. - <a class="btn btn-google" href="login/google" target="_self">
  43. + <a class="btn btn-google" href="login/google" target="_self" ng-if="googleAuthEnabled">
  44. <i class="fa fa-google"></i>
  45. with Google
  46. </a>
  47. - <a class="btn btn-github" href="login/github" target="_self">
  48. + <a class="btn btn-github" href="login/github" target="_self" ng-if="githubAuthEnabled">
  49. <i class="fa fa-github"></i>
  50. with Github
  51. </a>