Remove public registration and require that a user be registered by an admin

This commit is contained in:
James Allen
2015-03-19 14:22:48 +00:00
parent d76ef86077
commit 9b8cf7bcfa
16 changed files with 217 additions and 177 deletions
+1
View File
@@ -14,6 +14,7 @@ define [
"main/subscription-dashboard"
"main/new-subscription"
"main/annual-upgrade"
"main/register-users"
"analytics/AbTestingManager"
"directives/asyncForm"
"directives/stopPropagation"
@@ -0,0 +1,32 @@
define [
"base"
], (App) ->
App.controller "RegisterUsersController", ($scope, queuedHttp) ->
$scope.users = []
$scope.inputs =
emails: ""
parseEmails = (emailsString)->
regexBySpaceOrComma = /[\s,]+/
emails = emailsString.split(regexBySpaceOrComma)
emails = _.map emails, (email)->
email = email.trim()
emails = _.select emails, (email)->
email.indexOf("@") != -1
return emails
$scope.registerUsers = () ->
emails = parseEmails($scope.inputs.emails)
$scope.error = false
for email in emails
queuedHttp
.post("/admin/register", {
email: email,
_csrf: window.csrfToken
})
.success (user) ->
$scope.users.push user
$scope.inputs.emails = ""
.error () ->
$scope.error = true