Support invite codes for verification of email

Also changes the system so we don't apply the invite until it is called explicitly from the frontend

Fixes #241
This commit is contained in:
Joseph Schorr 2015-07-16 15:00:51 +03:00
parent 5d86fa80e7
commit 687bab1c05
7 changed files with 3185 additions and 35 deletions

View file

@ -9,6 +9,7 @@ angular.module('quay').directive('signinForm', function () {
transclude: true,
restrict: 'C',
scope: {
'inviteCode': '=inviteCode',
'redirectUrl': '=redirectUrl',
'signInStarted': '&signInStarted',
'signedIn': '&signedIn'
@ -49,6 +50,10 @@ angular.module('quay').directive('signinForm', function () {
$scope.markStarted();
$scope.cancelInterval();
if ($scope.inviteCode) {
$scope.user['invite_code'] = $scope.inviteCode;
}
ApiService.signinUser($scope.user).then(function() {
$scope.signingIn = false;
$scope.needsEmailVerification = false;

View file

@ -35,11 +35,13 @@ angular.module('quay').directive('signupForm', function () {
mixpanel.alias($scope.newUser.username);
}
if (!$scope.awaitingConfirmation) {
$scope.userRegistered({'username': $scope.newUser.username});
if (!$scope.awaitingConfirmation && !$scope.inviteCode) {
document.location = '/';
}
$scope.userRegistered({'username': $scope.newUser.username});
UserService.load();
}, function(result) {
$scope.registering = false;
UIService.showFormError('#signupButton', result);