Added disable user sign up feature

This commit is contained in:
Torkel Ödegaard 2015-01-29 15:46:36 +01:00
parent 3b5c813be7
commit 740709da04
3 changed files with 4 additions and 15 deletions

View File

@ -7,8 +7,7 @@ function (angular, config) {
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
module.controller('LoginCtrl', function($scope, backendSrv, $location, $routeParams) { module.controller('LoginCtrl', function($scope, backendSrv) {
$scope.formModel = { $scope.formModel = {
user: '', user: '',
email: '', email: '',
@ -19,6 +18,7 @@ function (angular, config) {
$scope.googleAuthEnabled = config.googleAuthEnabled; $scope.googleAuthEnabled = config.googleAuthEnabled;
$scope.githubAuthEnabled = config.githubAuthEnabled; $scope.githubAuthEnabled = config.githubAuthEnabled;
$scope.disableUserSignUp = config.disableUserSignUp;
$scope.loginMode = true; $scope.loginMode = true;
$scope.submitBtnClass = 'btn-inverse'; $scope.submitBtnClass = 'btn-inverse';
@ -26,10 +26,6 @@ function (angular, config) {
$scope.strengthClass = ''; $scope.strengthClass = '';
$scope.init = function() { $scope.init = function() {
if ($routeParams.logout) {
$scope.logout();
}
$scope.$watch("loginMode", $scope.loginModeChanged); $scope.$watch("loginMode", $scope.loginModeChanged);
$scope.passwordChanged(); $scope.passwordChanged();
}; };
@ -84,13 +80,6 @@ function (angular, config) {
}); });
}; };
$scope.logout = function() {
backendSrv.post('/logout').then(function() {
$scope.appEvent('logged-out');
$location.search({});
});
};
$scope.login = function() { $scope.login = function() {
delete $scope.loginError; delete $scope.loginError;

View File

@ -11,7 +11,7 @@
<button class="btn-login-tab" ng-click="loginMode = true;" ng-class="{active: loginMode}"> <button class="btn-login-tab" ng-click="loginMode = true;" ng-class="{active: loginMode}">
Log in Log in
</button> </button>
<button class="btn-login-tab" ng-click="loginMode = false;" ng-class="{active: !loginMode}"> <button class="btn-login-tab" ng-click="loginMode = false;" ng-class="{active: !loginMode}" ng-if="!disableUserSignUp">
Sign up Sign up
</button> </button>
</div> </div>

View File

@ -8,7 +8,7 @@
<span class="gravatar-email small">{{grafana.user.login}}</span> <span class="gravatar-email small">{{grafana.user.login}}</span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="{{appSubUrl}}/login?logout">Logout</a></li> <li><a href="{{appSubUrl}}/logout" target="_self">Logout</a></li>
</ul> </ul>
</li> </li>
<li ng-if="!grafana.user.isSignedIn"> <li ng-if="!grafana.user.isSignedIn">