Wednesday, June 21, 2017

ADFS : Remove the "Cancel" button from the Update Password screen

This is for ADFS 3.0 / 4.0 (Server 2012 R2 / 2016).

I don't actually get the "Cancel" button on this screen. It doesn't seem to do anything and just confuses people.


So why not remove it?

This is just another change to onload.js. (See this for how to make a new theme etc.).


// Remove Cancel button for "Update Password" screen

if ( document.getElementById("cancelButton") ) {
   document.getElementById("cancelButton").outerHTML = "";
}

Notice the user of "outerHTML" to remove the whole element.

Enjoy!

1 comment:

Nutshell said...

If you visit the change password page directly it doesn't work. However if you add this to your onload.js.....

// ADFS cancel button on the Update Password page (Expired Password) to redirect back to the original page
var RedirectToPage = function () {
var CurrentUrl = window.location.href;
var UrlParts = CurrentUrl.split("origin=");
var PathParts = UrlParts[1].split("&username=");
var RedirectUrl = UrlParts[0].replace("/adfs/portal/updatepassword", decodeURIComponent(PathParts[0]));
RedirectUrl = RedirectUrl.replace(/&$/, '');
location.href = RedirectUrl;
return false;
}

document.getElementById("cancelButton").onclick = RedirectToPage;


any website that forces you to change your password, the above will redirect you back to that site when you click cancel.