default collection on org create
This commit is contained in:
parent
465304b004
commit
c89b641b88
|
@ -288,8 +288,12 @@ angular
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
_service.makeShareKeyCt = function () {
|
_service.makeShareKey = function () {
|
||||||
return _service.rsaEncryptMe(forge.random.getBytesSync(512 / 8));
|
var key = forge.random.getBytesSync(512 / 8);
|
||||||
|
return {
|
||||||
|
key: new SymmetricCryptoKey(key),
|
||||||
|
ct: _service.rsaEncryptMe(key)
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_service.hashPassword = function (password, key) {
|
_service.hashPassword = function (password, key) {
|
||||||
|
|
|
@ -58,7 +58,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submit = function (model, form) {
|
$scope.submit = function (model, form) {
|
||||||
var shareKeyCt = cryptoService.makeShareKeyCt();
|
var shareKey = cryptoService.makeShareKey();
|
||||||
|
var defaultCollectionCt = cryptoService.encrypt('Default Collection', shareKey.key);
|
||||||
|
|
||||||
if ($scope.selfHosted) {
|
if ($scope.selfHosted) {
|
||||||
var fileEl = document.getElementById('file');
|
var fileEl = document.getElementById('file');
|
||||||
|
@ -70,7 +71,8 @@
|
||||||
|
|
||||||
var fd = new FormData();
|
var fd = new FormData();
|
||||||
fd.append('license', files[0]);
|
fd.append('license', files[0]);
|
||||||
fd.append('key', shareKeyCt);
|
fd.append('key', shareKey.ct);
|
||||||
|
fd.append('collectionName', defaultCollectionCt);
|
||||||
|
|
||||||
$scope.submitPromise = apiService.organizations.postLicense(fd).$promise.then(finalizeCreate);
|
$scope.submitPromise = apiService.organizations.postLicense(fd).$promise.then(finalizeCreate);
|
||||||
}
|
}
|
||||||
|
@ -79,8 +81,9 @@
|
||||||
var freeRequest = {
|
var freeRequest = {
|
||||||
name: model.name,
|
name: model.name,
|
||||||
planType: model.plan,
|
planType: model.plan,
|
||||||
key: shareKeyCt,
|
key: shareKey.ct,
|
||||||
billingEmail: model.billingEmail
|
billingEmail: model.billingEmail,
|
||||||
|
collectionName: defaultCollectionCt
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitPromise = apiService.organizations.post(freeRequest).$promise.then(finalizeCreate);
|
$scope.submitPromise = apiService.organizations.post(freeRequest).$promise.then(finalizeCreate);
|
||||||
|
@ -104,12 +107,13 @@
|
||||||
name: model.name,
|
name: model.name,
|
||||||
planType: model.interval === 'month' ? $scope.plans[model.plan].monthPlanType :
|
planType: model.interval === 'month' ? $scope.plans[model.plan].monthPlanType :
|
||||||
$scope.plans[model.plan].annualPlanType,
|
$scope.plans[model.plan].annualPlanType,
|
||||||
key: shareKeyCt,
|
key: shareKey.ct,
|
||||||
paymentToken: response.id,
|
paymentToken: response.id,
|
||||||
additionalSeats: model.additionalSeats,
|
additionalSeats: model.additionalSeats,
|
||||||
additionalStorageGb: model.additionalStorageGb,
|
additionalStorageGb: model.additionalStorageGb,
|
||||||
billingEmail: model.billingEmail,
|
billingEmail: model.billingEmail,
|
||||||
businessName: model.ownedBusiness ? model.businessName : null
|
businessName: model.ownedBusiness ? model.businessName : null,
|
||||||
|
collectionName: defaultCollectionCt
|
||||||
};
|
};
|
||||||
|
|
||||||
return apiService.organizations.post(paidRequest).$promise;
|
return apiService.organizations.post(paidRequest).$promise;
|
||||||
|
@ -121,7 +125,7 @@
|
||||||
|
|
||||||
function finalizeCreate(result) {
|
function finalizeCreate(result) {
|
||||||
$analytics.eventTrack('Created Organization');
|
$analytics.eventTrack('Created Organization');
|
||||||
authService.addProfileOrganizationOwner(result, shareKeyCt);
|
authService.addProfileOrganizationOwner(result, shareKey.ct);
|
||||||
authService.refreshAccessToken().then(function () {
|
authService.refreshAccessToken().then(function () {
|
||||||
goToOrg(result.Id);
|
goToOrg(result.Id);
|
||||||
}, function () {
|
}, function () {
|
||||||
|
|
Loading…
Reference in New Issue