c0286d1ac3
Fixes #306 - Adds support for Dex as an OAuth external login provider - Adds support for OIDC in general - Extract out external logins on the JS side into a service - Add a feature flag for disabling direct login - Add support for directing to the single external login service - Does *not* yet support the config in the superuser tool
55 lines
No EOL
1.7 KiB
JavaScript
55 lines
No EOL
1.7 KiB
JavaScript
/**
|
|
* 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, UIService, ExternalLoginService) {
|
|
$('.form-signup').popover();
|
|
|
|
$scope.awaitingConfirmation = false;
|
|
$scope.registering = false;
|
|
$scope.EXTERNAL_LOGINS = ExternalLoginService.EXTERNAL_LOGINS;
|
|
$scope.singleSigninUrl = ExternalLoginService.getSingleSigninUrl();
|
|
|
|
$scope.register = function() {
|
|
UIService.hidePopover('#signupButton');
|
|
$scope.registering = true;
|
|
|
|
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) {
|
|
document.location = '/';
|
|
}
|
|
|
|
UserService.load();
|
|
}, function(result) {
|
|
$scope.registering = false;
|
|
UIService.showFormError('#signupButton', result);
|
|
});
|
|
};
|
|
}
|
|
};
|
|
return directiveDefinitionObject;
|
|
}); |