initial import for Open Source 🎉
This commit is contained in:
parent
1898c361f3
commit
9c0dd3b722
2048 changed files with 218743 additions and 0 deletions
54
static/js/directives/ui/signup-form.js
Normal file
54
static/js/directives/ui/signup-form.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* An element which displays the sign up form.
|
||||
*/
|
||||
angular.module('quay').directive('signupForm', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/signup-form.html',
|
||||
replace: false,
|
||||
transclude: true,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'inviteCode': '=inviteCode',
|
||||
'hideRegisteredMessage': '@hideRegisteredMessage',
|
||||
'userRegistered': '&userRegistered'
|
||||
},
|
||||
controller: function($scope, $location, $timeout, ApiService, KeyService, UserService, Config, ExternalLoginService) {
|
||||
$scope.awaitingConfirmation = false;
|
||||
$scope.registering = false;
|
||||
$scope.Config = Config;
|
||||
$scope.registerIssue = null;
|
||||
|
||||
$scope.register = function() {
|
||||
$scope.registering = true;
|
||||
$scope.registerIssue = null;
|
||||
|
||||
if ($scope.inviteCode) {
|
||||
$scope.newUser['invite_code'] = $scope.inviteCode;
|
||||
}
|
||||
|
||||
ApiService.createNewUser($scope.newUser).then(function(resp) {
|
||||
$scope.registering = false;
|
||||
$scope.awaitingConfirmation = !!resp['awaiting_verification'];
|
||||
|
||||
if (Config.MIXPANEL_KEY) {
|
||||
mixpanel.alias($scope.newUser.username);
|
||||
}
|
||||
|
||||
$scope.userRegistered({'username': $scope.newUser.username});
|
||||
|
||||
if (!$scope.awaitingConfirmation && !$scope.inviteCode) {
|
||||
$location.path("/");
|
||||
|
||||
}
|
||||
|
||||
UserService.load();
|
||||
}, function(result) {
|
||||
$scope.registering = false;
|
||||
$scope.registerIssue = ApiService.getErrorMessage(result);
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
Reference in a new issue