1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

private mode page with message

This commit is contained in:
Kyle Spearrin 2017-09-09 15:41:49 -04:00
parent ac00d1f106
commit 60d75ce5fe
10 changed files with 133 additions and 79 deletions

View File

@ -747,5 +747,8 @@
},
"commandGeneratePasswordDesc": {
"message": "Generate and copy a new random password to the clipboard."
},
"privateModeMessage": {
"message": "Unfortunately this window is not available in private mode for this browser."
}
}

View File

@ -11,6 +11,12 @@
$urlRouterProvider.otherwise(function ($injector, $location) {
var $state = $injector.get('$state');
if (!chrome.extension.getBackgroundPage()) {
$state.go('privateMode');
return;
}
var userService = $injector.get('userService');
var cryptoService = $injector.get('cryptoService');
@ -34,14 +40,21 @@
$stateProvider
.state('splash', {
url: '/splash',
controller: 'splashController',
controller: 'baseController',
templateUrl: 'app/global/splash.html',
data: { authorize: false },
params: { animation: null }
})
.state('privateMode', {
url: '/private-mode',
controller: 'privateModeController',
templateUrl: 'app/global/privateMode.html',
data: { authorize: false },
params: { animation: null }
})
.state('home', {
url: '/home',
controller: 'homeController',
controller: 'baseController',
templateUrl: 'app/global/home.html',
data: { authorize: false },
params: { animation: null }
@ -248,6 +261,10 @@
stateService.purgeState();
}
if (!userService) {
return;
}
userService.isAuthenticated(function (isAuthenticated) {
if (isAuthenticated) {
var obj = {};

View File

@ -1,6 +1,6 @@
angular
.module('bit.global')
.controller('homeController', function ($scope, i18nService) {
.controller('baseController', function ($scope, i18nService) {
$scope.i18n = i18nService;
});

View File

@ -7,7 +7,7 @@ angular
self.currentYear = new Date().getFullYear();
self.animation = '';
self.shBody = $window.screen.availHeight <= 800;
self.lgBody = !utilsService.isFirefox() && !utilsService.isEdge() && !self.shBody;
self.lgBody = utilsService && !utilsService.isFirefox() && !utilsService.isEdge() && !self.shBody;
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
if (toParams.animation) {

View File

@ -0,0 +1,6 @@
<div class="content text-center">
<p>{{privateModeMessage}}</p>
<button type="button" class="btn btn-lg btn-link btn-block" ng-click="learnMore()">
{{learnMoreMessage}}
</button>
</div>

View File

@ -0,0 +1,10 @@
angular
.module('bit.global')
.controller('privateModeController', function ($scope) {
$scope.privateModeMessage = chrome.i18n.getMessage("privateModeMessage");
$scope.learnMoreMessage = chrome.i18n.getMessage("learnMore");
$scope.learnMore = function () {
chrome.tabs.create({ url: 'https://help.bitwarden.com/article/extension-wont-load-in-private-mode/' });
};
});

View File

@ -1,6 +0,0 @@
angular
.module('bit.global')
.controller('splashController', function ($scope) {
});

View File

@ -2,53 +2,70 @@
.module('bit.services')
.factory('tokenService', function () {
return chrome.extension.getBackgroundPage().bg_tokenService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_tokenService : null;
})
.factory('cryptoService', function () {
return chrome.extension.getBackgroundPage().bg_cryptoService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_cryptoService : null;
})
.factory('userService', function () {
return chrome.extension.getBackgroundPage().bg_userService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_userService : null;
})
.factory('apiService', function () {
return chrome.extension.getBackgroundPage().bg_apiService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_apiService : null;
})
.factory('folderService', function () {
return chrome.extension.getBackgroundPage().bg_folderService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_folderService : null;
})
.factory('loginService', function () {
return chrome.extension.getBackgroundPage().bg_loginService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_loginService : null;
})
.factory('syncService', function () {
return chrome.extension.getBackgroundPage().bg_syncService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_syncService : null;
})
.factory('autofillService', function () {
return chrome.extension.getBackgroundPage().bg_autofillService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_autofillService : null;
})
.factory('passwordGenerationService', function () {
return chrome.extension.getBackgroundPage().bg_passwordGenerationService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_passwordGenerationService : null;
})
.factory('utilsService', function () {
return chrome.extension.getBackgroundPage().bg_utilsService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_utilsService : null;
})
.factory('appIdService', function () {
return chrome.extension.getBackgroundPage().bg_appIdService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_appIdService : null;
})
.factory('i18nService', function () {
return chrome.extension.getBackgroundPage().bg_i18nService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_i18nService : null;
})
.factory('constantsService', function () {
return chrome.extension.getBackgroundPage().bg_constantsService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_constantsService : null;
})
.factory('settingsService', function () {
return chrome.extension.getBackgroundPage().bg_settingsService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_settingsService : null;
})
.factory('lockService', function () {
return chrome.extension.getBackgroundPage().bg_lockService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_lockService : null;
})
.factory('totpService', function () {
return chrome.extension.getBackgroundPage().bg_totpService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_totpService : null;
})
.factory('environmentService', function () {
return chrome.extension.getBackgroundPage().bg_environmentService;
var page = chrome.extension.getBackgroundPage();
return page ? page.bg_environmentService : null;
});

View File

@ -53,8 +53,8 @@
<script src="app/global/globalModule.js"></script>
<script src="app/global/mainController.js"></script>
<script src="app/global/tabsController.js"></script>
<script src="app/global/splashController.js"></script>
<script src="app/global/homeController.js"></script>
<script src="app/global/baseController.js"></script>
<script src="app/global/privateModeController.js"></script>
<script src="app/accounts/accountsModule.js"></script>
<script src="app/accounts/accountsLoginController.js"></script>

View File

@ -1,6 +1,12 @@
var gaTrackingId = chrome.extension.getBackgroundPage().bg_utilsService.analyticsId();
(function () {
var bgPage = chrome.extension.getBackgroundPage();
if (!bgPage) {
return;
}
var gaTrackingId = bgPage.bg_utilsService.analyticsId();
var gaFunc = null;
var isFirefox = chrome.extension.getBackgroundPage().bg_utilsService.isFirefox();
var isFirefox = bgPage.bg_utilsService.isFirefox();
window.GoogleAnalyticsObject = 'ga';
window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3, param4) {
@ -30,7 +36,7 @@ function gaTrackPageView(pagePath) {
return '&t=pageview&dp=' + encodeURIComponent(pagePath);
}
chrome.extension.getBackgroundPage().bg_appIdService.getAnonymousAppId(function (gaAnonAppId) {
bgPage.bg_appIdService.getAnonymousAppId(function (gaAnonAppId) {
gaFunc = function (action, param1, param2, param3, param4) {
if (action !== 'send' || !param1) {
return;
@ -58,3 +64,4 @@ chrome.extension.getBackgroundPage().bg_appIdService.getAnonymousAppId(function
ga('send', 'pageview', '/background.html');
}
});
})();