mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
fix callbacks for user service methods
This commit is contained in:
@@ -23,20 +23,22 @@ angular
|
||||
var userService = $injector.get('userService');
|
||||
var cryptoService = $injector.get('cryptoService');
|
||||
|
||||
cryptoService.getKey().then(function (key) {
|
||||
userService.isAuthenticated(function (isAuthenticated) {
|
||||
if (isAuthenticated) {
|
||||
if (!key) {
|
||||
$state.go('lock');
|
||||
}
|
||||
else {
|
||||
$state.go('tabs.current');
|
||||
}
|
||||
var key;
|
||||
cryptoService.getKey().then(function (theKey) {
|
||||
key = theKey;
|
||||
return userService.isAuthenticated();
|
||||
}).then(function (isAuthenticated) {
|
||||
if (isAuthenticated) {
|
||||
if (!key) {
|
||||
$state.go('lock');
|
||||
}
|
||||
else {
|
||||
$state.go('home');
|
||||
$state.go('tabs.current');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$state.go('home');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -269,7 +271,7 @@ angular
|
||||
|
||||
stateService.init();
|
||||
|
||||
$transitions.onStart({}, function(trans) {
|
||||
$transitions.onStart({}, function (trans) {
|
||||
const $state = trans.router.stateService;
|
||||
const toState = trans.to();
|
||||
|
||||
@@ -284,7 +286,7 @@ angular
|
||||
return;
|
||||
}
|
||||
|
||||
userService.isAuthenticated((isAuthenticated) => {
|
||||
userService.isAuthenticated().then((isAuthenticated) => {
|
||||
if (isAuthenticated) {
|
||||
var obj = {};
|
||||
obj[constantsService.lastActiveKey] = (new Date()).getTime();
|
||||
|
||||
@@ -24,7 +24,7 @@ angular
|
||||
};
|
||||
|
||||
$scope.submit = function () {
|
||||
userService.getEmail(function (email) {
|
||||
userService.getEmail().then(function (email) {
|
||||
var key = cryptoService.makeKey($scope.masterPassword, email);
|
||||
var keyHash;
|
||||
cryptoService.hashPassword($scope.masterPassword, key).then(function (theKeyHash) {
|
||||
|
||||
@@ -22,7 +22,7 @@ angular
|
||||
function checkPassword() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
userService.getEmail(function (email) {
|
||||
userService.getEmail().then(function (email) {
|
||||
var key = cryptoService.makeKey($scope.masterPassword, email);
|
||||
var keyHash;
|
||||
cryptoService.hashPassword($scope.masterPassword, key).then(function (theKeyHash) {
|
||||
|
||||
Reference in New Issue
Block a user