1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Added setting to not store key via lock options, only keeping it in memory. Fixed some i18n and created constants service

This commit is contained in:
Kyle Spearrin
2016-10-24 22:16:47 -04:00
parent 25fef2d826
commit 80ed37ada6
18 changed files with 400 additions and 65 deletions

View File

@@ -163,27 +163,41 @@
controller: 'settingsEditFolderController',
data: { authorize: true },
params: { animation: null }
})
.state('lock', {
url: '/lock',
templateUrl: 'app/lock/views/lock.html',
controller: 'lockController',
data: { authorize: true },
params: { animation: null }
});
})
.run(function ($rootScope, userService, loginService, tokenService, $state) {
.run(function ($rootScope, userService, loginService, cryptoService, tokenService, $state) {
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
tokenService.getToken(function (token) {
userService.isAuthenticated(function (isAuthenticated) {
if (!toState.data || !toState.data.authorize) {
if (isAuthenticated && !tokenService.isTokenExpired(token)) {
event.preventDefault();
$state.go('tabs.current');
cryptoService.getKey(false, function (key) {
tokenService.getToken(function (token) {
userService.isAuthenticated(function (isAuthenticated) {
if (!toState.data || !toState.data.authorize) {
if (isAuthenticated && !tokenService.isTokenExpired(token)) {
event.preventDefault();
if (!key) {
$state.go('lock');
}
else {
$state.go('tabs.current');
}
}
return;
}
return;
}
if (!isAuthenticated || tokenService.isTokenExpired(token)) {
event.preventDefault();
loginService.logOut(function () {
$state.go('home');
});
}
if (!isAuthenticated || tokenService.isTokenExpired(token)) {
event.preventDefault();
loginService.logOut(function () {
$state.go('home');
});
}
});
});
});
});