diff --git a/settings.json b/settings.json
index eed5d69b5d..bc9ea4838d 100644
--- a/settings.json
+++ b/settings.json
@@ -1,6 +1,5 @@
{
"appSettings": {
- "rememberedEmailCookieName": "bit.rememberedEmail",
"apiUri": "http://localhost:4000"
}
}
diff --git a/src/app/accounts/accountsLoginController.js b/src/app/accounts/accountsLoginController.js
index c0f6ec313d..480f9a4239 100644
--- a/src/app/accounts/accountsLoginController.js
+++ b/src/app/accounts/accountsLoginController.js
@@ -2,10 +2,10 @@ angular
.module('bit.accounts')
.controller('accountsLoginController', function ($scope, $rootScope, $cookies, apiService, cryptoService, authService,
- $state, appSettings, $analytics) {
+ $state, constants, $analytics) {
$scope.state = $state;
var returnState = $state.params.returnState;
- var rememberedEmail = $cookies.get(appSettings.rememberedEmailCookieName);
+ var rememberedEmail = $cookies.get(constants.rememberedEmailCookieName);
if (rememberedEmail || $state.params.email) {
$scope.model = {
email: $state.params.email ? $state.params.email : rememberedEmail,
@@ -25,12 +25,12 @@ angular
cookieExpiration.setFullYear(cookieExpiration.getFullYear() + 10);
$cookies.put(
- appSettings.rememberedEmailCookieName,
+ constants.rememberedEmailCookieName,
model.email,
{ expires: cookieExpiration });
}
else {
- $cookies.remove(appSettings.rememberedEmailCookieName);
+ $cookies.remove(constants.rememberedEmailCookieName);
}
if (twoFactorProviders && twoFactorProviders.length > 0) {
diff --git a/src/app/constants.js b/src/app/constants.js
new file mode 100644
index 0000000000..272513891d
--- /dev/null
+++ b/src/app/constants.js
@@ -0,0 +1,40 @@
+angular.module('bit')
+ .constant('constants', {
+ rememberedEmailCookieName: 'bit.rememberedEmail',
+ encType: {
+ AesCbc256_B64: 0,
+ AesCbc128_HmacSha256_B64: 1,
+ AesCbc256_HmacSha256_B64: 2,
+ RsaOaep_Sha256_B64: 3
+ },
+ plans: {
+ free: {
+ basePrice: 0,
+ noAdditionalSeats: true,
+ noPayment: true,
+ upgradeSortOrder: -1
+ },
+ personal: {
+ basePrice: 1,
+ annualBasePrice: 12,
+ baseSeats: 5,
+ seatPrice: 1,
+ annualSeatPrice: 12,
+ maxAdditionalSeats: 5,
+ annualPlanType: 'personalAnnually',
+ upgradeSortOrder: 1
+ },
+ teams: {
+ basePrice: 5,
+ annualBasePrice: 60,
+ monthlyBasePrice: 8,
+ baseSeats: 5,
+ seatPrice: 2,
+ annualSeatPrice: 24,
+ monthlySeatPrice: 2.5,
+ monthPlanType: 'teamsMonthly',
+ annualPlanType: 'teamsAnnually',
+ upgradeSortOrder: 2
+ }
+ }
+ });
diff --git a/src/app/directives/letterAvatarDirective.js b/src/app/directives/letterAvatarDirective.js
index 863b3efd5e..a1b1738531 100644
--- a/src/app/directives/letterAvatarDirective.js
+++ b/src/app/directives/letterAvatarDirective.js
@@ -5,13 +5,14 @@ angular
.directive('letterAvatar', function () {
// ref: http://stackoverflow.com/a/16348977/1090359
function stringToColor(str) {
- var hash = 0;
- for (var i = 0; i < str.length; i++) {
+ var hash = 0,
+ i = 0;
+ for (i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var color = '#';
- for (var i = 0; i < 3; i++) {
+ for (i = 0; i < 3; i++) {
var value = (hash >> (i * 8)) & 0xFF;
color += ('00' + value.toString(16)).substr(-2);
}
diff --git a/src/app/organization/organizationBillingController.js b/src/app/organization/organizationBillingController.js
index dfdef88f3b..3f2e13782d 100644
--- a/src/app/organization/organizationBillingController.js
+++ b/src/app/organization/organizationBillingController.js
@@ -76,6 +76,8 @@
$scope.loading = false;
$scope.noSubscription = org.PlanType === 0;
+ var i = 0;
+
$scope.plan = {
name: org.Plan,
type: org.PlanType,
@@ -103,7 +105,7 @@
if (org.Subscription && org.Subscription.Items) {
$scope.subscription.items = [];
- for (var i = 0; i < org.Subscription.Items.length; i++) {
+ for (i = 0; i < org.Subscription.Items.length; i++) {
$scope.subscription.items.push({
amount: org.Subscription.Items[i].Amount,
name: org.Subscription.Items[i].Name,
@@ -123,7 +125,7 @@
}
var charges = [];
- for (var i = 0; i < org.Charges.length; i++) {
+ for (i = 0; i < org.Charges.length; i++) {
charges.push({
date: org.Charges[i].CreatedDate,
paymentSource: org.Charges[i].PaymentSource ? org.Charges[i].PaymentSource.Description : '-',
diff --git a/src/app/services/cryptoService.js b/src/app/services/cryptoService.js
index e3c0cc02b3..b8830bd60a 100644
--- a/src/app/services/cryptoService.js
+++ b/src/app/services/cryptoService.js
@@ -1,19 +1,13 @@
angular
.module('bit.services')
- .factory('cryptoService', function ($sessionStorage) {
+ .factory('cryptoService', function ($sessionStorage, constants) {
var _service = {},
_key,
_b64Key,
_privateKey,
_publicKey,
- _orgKeys,
- _encType = {
- AesCbc256_B64: 0,
- AesCbc128_HmacSha256_B64: 1,
- AesCbc256_HmacSha256_B64: 2,
- RsaOaep_Sha256_B64: 3
- };
+ _orgKeys;
_service.setKey = function (key) {
_key = key;
@@ -261,11 +255,11 @@ angular
var encKey, encType;
if (false) {
encKey = _service.getEncKey(key);
- encType = _encType.AesCbc128_HmacSha256_B64;
+ encType = constants.encType.AesCbc128_HmacSha256_B64;
}
else {
encKey = key || _service.getKey();
- encType = _encType.AesCbc256_B64;
+ encType = constants.encType.AesCbc256_B64;
}
plainValueEncoding = plainValueEncoding || 'utf8';
@@ -281,7 +275,8 @@ angular
var ct = forge.util.encode64(ctBytes);
var cipherString = iv + '|' + ct;
- if (encType === _encType.AesCbc128_HmacSha256_B64 || encType === _encType.AesCbc256_HmacSha256_B64) {
+ if (encType === constants.encType.AesCbc128_HmacSha256_B64 ||
+ encType === constants.encType.AesCbc256_HmacSha256_B64) {
var mac = computeMac(ctBytes, ivBytes);
cipherString = cipherString + '|' + mac;
}
@@ -304,7 +299,7 @@ angular
var encryptedBytes = publicKey.encrypt(plainValue, 'RSA-OAEP', {
md: forge.md.sha256.create()
});
- return _encType.RsaOaep_Sha256_B64 + '.' + forge.util.encode64(encryptedBytes);
+ return constants.encType.RsaOaep_Sha256_B64 + '.' + forge.util.encode64(encryptedBytes);
};
_service.decrypt = function (encValue, key, outputEncoding) {
@@ -324,26 +319,26 @@ angular
}
}
else {
- encType = _encType.AesCbc256_B64;
+ encType = constants.encType.AesCbc256_B64;
encPieces = encValue.split('|');
}
switch (encType) {
- case _encType.AesCbc128_HmacSha256_B64:
+ case constants.encType.AesCbc128_HmacSha256_B64:
if (encPieces.length !== 3) {
return null;
}
doMacCheck = true;
encKey = _service.getEncKey(key);
break;
- case _encType.AesCbc256_HmacSha256_B64:
+ case constants.encType.AesCbc256_HmacSha256_B64:
if (encPieces.length !== 3) {
return null;
}
doMacCheck = true;
encKey = _service.getEncKey(key);
break;
- case _encType.AesCbc256_B64:
+ case constants.encType.AesCbc256_B64:
if (encPieces.length !== 2) {
return null;
}
@@ -395,7 +390,7 @@ angular
encPiece;
if (headerPieces.length === 1) {
- encType = _encType.RsaOaep_Sha256_B64;
+ encType = constants.encType.RsaOaep_Sha256_B64;
encPiece = headerPieces[0];
}
else if (headerPieces.length === 2) {
@@ -408,7 +403,7 @@ angular
}
}
- if (encType !== _encType.RsaOaep_Sha256_B64) {
+ if (encType !== constants.encType.RsaOaep_Sha256_B64) {
return null;
}
diff --git a/src/app/settings.js b/src/app/settings.js
index 00329f52c1..5ebf43a174 100644
--- a/src/app/settings.js
+++ b/src/app/settings.js
@@ -1,2 +1,2 @@
angular.module("bit")
-.constant("appSettings", {"rememberedEmailCookieName":"bit.rememberedEmail","apiUri":"https://api.bitwarden.com","version":"1.9.1","environment":"Production"});
+.constant("appSettings", {"apiUri":"https://api.bitwarden.com","version":"1.9.1","environment":"Production"});
diff --git a/src/app/settings/settingsCreateOrganizationController.js b/src/app/settings/settingsCreateOrganizationController.js
index 6653ee5c19..9086ef784e 100644
--- a/src/app/settings/settingsCreateOrganizationController.js
+++ b/src/app/settings/settingsCreateOrganizationController.js
@@ -2,34 +2,8 @@
.module('bit.settings')
.controller('settingsCreateOrganizationController', function ($scope, $state, apiService, cryptoService,
- toastr, $analytics, authService, stripe) {
- $scope.plans = {
- free: {
- basePrice: 0,
- noAdditionalSeats: true,
- noPayment: true
- },
- personal: {
- basePrice: 1,
- annualBasePrice: 12,
- baseSeats: 5,
- seatPrice: 1,
- annualSeatPrice: 12,
- maxAdditionalSeats: 5,
- annualPlanType: 'personalAnnually'
- },
- teams: {
- basePrice: 5,
- annualBasePrice: 60,
- monthlyBasePrice: 8,
- baseSeats: 5,
- seatPrice: 2,
- annualSeatPrice: 24,
- monthlySeatPrice: 2.5,
- monthPlanType: 'teamsMonthly',
- annualPlanType: 'teamsAnnually'
- }
- };
+ toastr, $analytics, authService, stripe, constants) {
+ $scope.plans = constants.plans;
$scope.model = {
plan: 'free',
@@ -57,7 +31,7 @@
$scope.changedBusiness = function () {
if ($scope.model.ownedBusiness) {
- $scope.model.plan = 'teams'
+ $scope.model.plan = 'teams';
}
};
diff --git a/src/index.html b/src/index.html
index e189960437..4b97b98e98 100644
--- a/src/index.html
+++ b/src/index.html
@@ -78,6 +78,7 @@
+