diff --git a/app/client/src/services/SettingsService.js b/app/client/src/services/SettingsService.js index f2789b3e1..96afe9eda 100644 --- a/app/client/src/services/SettingsService.js +++ b/app/client/src/services/SettingsService.js @@ -48,6 +48,11 @@ angular.module('reg') allowMinors: allowMinors }); }, + updateAllowAllEmails: function(allowAllEmails){ + return $http.put(base + 'allEmails', { + allowAllEmails: allowAllEmails + }); + }, }; } diff --git a/app/client/views/admin/settings/adminSettingsCtrl.js b/app/client/views/admin/settings/adminSettingsCtrl.js index c534ca89c..60be091d7 100644 --- a/app/client/views/admin/settings/adminSettingsCtrl.js +++ b/app/client/views/admin/settings/adminSettingsCtrl.js @@ -36,6 +36,18 @@ angular.module('reg') }); }; + $scope.updateAllowAllEmails = function () { + SettingsService + .updateAllowAllEmails($scope.settings.allowAllEmails) + .success(function (data) { + $scope.settings.allowAllEmails = data.allowAllEmails; + const successText = $scope.settings.allowAllEmails ? + "All emails are now allowed to register." : + "Only whitelisted emails are now allowed to register." + swal("Looks good!", successText, "success"); + }); + }; + // Whitelist -------------------------------------- SettingsService diff --git a/app/client/views/admin/settings/settings.html b/app/client/views/admin/settings/settings.html index ae67b32f0..9d711263b 100644 --- a/app/client/views/admin/settings/settings.html +++ b/app/client/views/admin/settings/settings.html @@ -99,6 +99,17 @@ +