diff --git a/config.py b/config.py index 1cd28f967..ca1d0ce65 100644 --- a/config.py +++ b/config.py @@ -18,7 +18,7 @@ def build_requests_session(): # values are set to the frontend, DO NOT PLACE ANY SECRETS OR KEYS in this list. CLIENT_WHITELIST = ['SERVER_HOSTNAME', 'PREFERRED_URL_SCHEME', 'GITHUB_CLIENT_ID', 'GITHUB_LOGIN_CLIENT_ID', 'MIXPANEL_KEY', 'STRIPE_PUBLISHABLE_KEY', - 'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN'] + 'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN', 'AUTHENTICATION_TYPE'] def getFrontendVisibleConfig(config_dict): diff --git a/endpoints/api/user.py b/endpoints/api/user.py index f21b77926..ee5e2e5e5 100644 --- a/endpoints/api/user.py +++ b/endpoints/api/user.py @@ -229,7 +229,12 @@ def conduct_signin(username_or_email, password): needs_email_verification = False invalid_credentials = False - verified = authentication.verify_user(username_or_email, password) + verified = None + try: + verified = authentication.verify_user(username_or_email, password) + except model.TooManyUsersException as ex: + raise license_error(exception=ex) + if verified: if common_login(verified): return {'success': True} @@ -247,6 +252,7 @@ def conduct_signin(username_or_email, password): @resource('/v1/user/convert') @internal_only +@show_if(app.config['AUTHENTICATION_TYPE'] == 'Database') class ConvertToOrganization(ApiResource): """ Operations for converting a user to an organization. """ schemas = { diff --git a/static/js/controllers.js b/static/js/controllers.js index e063630df..3a0d4bd1c 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -1589,7 +1589,7 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams } function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, UserService, CookieService, KeyService, - $routeParams, $http, UIService, Features) { + $routeParams, $http, UIService, Features, Config) { $scope.Features = Features; if ($routeParams['migrate']) { @@ -1597,11 +1597,9 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use } UserService.updateUserIn($scope, function(user) { - if (!Features.GITHUB_LOGIN) { return; } - $scope.cuser = jQuery.extend({}, user); - if ($scope.cuser.logins) { + if (Features.GITHUB_LOGIN && $scope.cuser.logins) { for (var i = 0; i < $scope.cuser.logins.length; i++) { if ($scope.cuser.logins[i].service == 'github') { var githubId = $scope.cuser.logins[i].service_identifier; @@ -1694,6 +1692,8 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use }; $scope.reallyConvert = function() { + if (Config.AUTHENTICATION_TYPE != 'Database') { return; } + $scope.loading = true; var data = { diff --git a/static/partials/organizations.html b/static/partials/organizations.html index ba591faae..4eaae8ca6 100644 --- a/static/partials/organizations.html +++ b/static/partials/organizations.html @@ -10,7 +10,7 @@ Create New Organization - +