How to prevent service portal redirection scripts from redirecting users setting up multi factor authentication?

User304920
Kilo Explorer

Hi all,

I'm currently facing an issue where our users are being redirected to our portal homepage when they attempt set up multi-factor authentication (after following this guide).

The button below pops up a modal iframe that presents the page "/google_auth_setup_dialog" for a fraction of a second, but the users are redirected back to the portal homepage before they can do anything.

find_real_file.png

We had a similar issue earlier when users were being redirected away from the password reset form, but that was fixed by inserting the following code into SPEntryPage script:

if (nt && nt.startsWith("$pwd_new.do")) 
    return;

I tried adding a similar block of code in this script for "google_auth_setup_dialog", but that does not resolve the issue...

Any help is appreciated, thank you!

3 REPLIES 3

Omkar Mone
Mega Sage

Hi 

Can you show the widget code written for the same? I suppose there is a <a href> and ng-click function inside it which is the giving a call to the client controller. Can you post both the scripts here?

 

Regards

Omkar Mone

Hi Omkar,

Is this what you mean? These snippets are from the User Profile widget.

<div class="list-group-item" ng-if="data.preferencesEnabled.mfaEnabled">
<button class="btn btn-link" ng-click="triggerMFAConfigurationModal()" aria-haspopup="dialog">${Configure Multi-Factor Authentication}</button>
</div>
$scope.triggerMFAConfigurationModal = function() {
		$scope.mfaModalInstance = $uibModal.open({
			templateUrl: 'mfaModalTemplate',
			scope: $scope,
			size: 'lg'
		});

		createCloseMFAModalHandler();
	}

	$scope.dismissMFAConfigurationModal = function() {
		$scope.mfaModalInstance.close();
	}

	$timeout(function(){
		$rootScope.$broadcast('finishedChanged', {profile: $scope.data.teamData});
	});

	$scope.sysUserModelFields = $scope.getSysUserModelFields();

	function createCloseMFAModalHandler() {
		// This is a hack. Wait for the inner iframe to load, then mock
		// the GlideDialogWindow close function to do the right thing. If it's not ready
		// after a second, try again 9 more times. 
		var retryCount = 0;
		var maxRetries = 10;
		tryOverrideGlideDialogWindowClose();
		function tryOverrideGlideDialogWindowClose() {
			$timeout(function() {
				var frameGlideDialogWindow = document.getElementById('mfa-config-window').contentWindow['GlideDialogWindow'];
				if (!frameGlideDialogWindow) {
					retryCount++;
					if (retryCount >= maxRetries)
						return;

					tryOverrideGlideDialogWindowClose();
					return;
				}

				frameGlideDialogWindow.get = function() {
					return {
						destroy: function() {
							$scope.dismissMFAConfigurationModal();
						}
					}
				};
			}, 1000);	
		}
	}

MattCD
Tera Contributor

Recently came across this exact issue. Cause was not SPentryPage. It was a custom UI script that triggers onload and redirects back to portal users if they don't have specific roles.

 

Restrict ESS or non-role users from navigating to native UI by manipulating the URL - Support and Tr...

Hope it helps someone.