Skip to content
Permalink
Browse files

Merge pull request #2126 from privacyidea/2122/fix-state-transitions

Replace stateChangeSuccess by transitions.onBefore and onSuccess
  • Loading branch information
cornelinux committed Mar 23, 2020
2 parents 67e0f79 + 66620dd commit 5805b523b1d168f256ef783cdae622d3caa9351a
Showing with 13 additions and 10 deletions.
  1. +13 −10 privacyidea/static/components/login/controllers/loginControllers.js
@@ -35,7 +35,7 @@ angular.module("privacyideaApp")
PolicyTemplateFactory, gettextCatalog,
hotkeys, RegisterFactory,
U2fFactory, webAuthnToken, instanceUrl,
PollingAuthFactory,
PollingAuthFactory, $transitions,
resourceNamePatterns) {

$scope.instanceUrl = instanceUrl;
@@ -102,19 +102,22 @@ angular.module("privacyideaApp")
$scope.myCountdown = "";
// We save the previous State in the $rootScope, so that we
// can return there
$rootScope.$on('$stateChangeSuccess',
function (ev, to, toParams, from, fromParams) {
//debug: console.log("we changed the state from " + from + " to " + to);
//debug: console.log(from);
//debug: console.log(fromParams);
//debug: console.log(to);
$transitions.onBefore({},
function () {
// The stateParams or $state.params are always changed as a reference.
// So we need to do a deep copy, to preserve it between state transitions
var oldParams = {};
angular.copy($state.params, oldParams);
$rootScope.previousState = {
state: from.name,
params: fromParams
state: $state.current.name,
params: oldParams
};

});
$transitions.onSuccess({},
function() {
$scope.checkReloadListeners();
});

$scope.$on('IdleStart', function () {
//debug: console.log("start idle");
});

0 comments on commit 5805b52

Please sign in to comment.
You can’t perform that action at this time.