mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
cc details on org create
This commit is contained in:
@@ -1,32 +1,37 @@
|
||||
angular
|
||||
.module('bit.settings')
|
||||
|
||||
.controller('settingsCreateOrganizationController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
|
||||
toastr, $analytics, authService) {
|
||||
.controller('settingsCreateOrganizationController', function($scope, $state, apiService, $uibModalInstance, cryptoService,
|
||||
toastr, $analytics, authService, stripe) {
|
||||
$analytics.eventTrack('settingsCreateOrganizationController', { category: 'Modal' });
|
||||
|
||||
$scope.model = {
|
||||
plan: 'Free'
|
||||
plan: 'Personal'
|
||||
};
|
||||
|
||||
$scope.submit = function (model) {
|
||||
var request = {
|
||||
name: model.name,
|
||||
planType: model.plan,
|
||||
key: cryptoService.makeShareKey()
|
||||
};
|
||||
$scope.submit = function(model) {
|
||||
$scope.submitPromise = stripe.card.createToken(model.card).then(function(response) {
|
||||
var request = {
|
||||
name: model.name,
|
||||
planType: model.plan,
|
||||
key: cryptoService.makeShareKey(),
|
||||
cardToken: response.id
|
||||
};
|
||||
|
||||
return apiService.organizations.post(request).$promise;
|
||||
}).then(function(result) {
|
||||
$scope.model.card = null;
|
||||
|
||||
$scope.submitPromise = apiService.organizations.post(request, function (result) {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
$analytics.eventTrack('Created Organization');
|
||||
authService.addProfileOrganization(result);
|
||||
$state.go('backend.org.dashboard', { orgId: result.Id }).then(function () {
|
||||
$state.go('backend.org.dashboard', { orgId: result.Id }).then(function() {
|
||||
toastr.success('Your new organization is ready to go!', 'Organization Created');
|
||||
});
|
||||
}).$promise;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.close = function () {
|
||||
$scope.close = function() {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user