Skip to content

Instantly share code, notes, and snippets.

@rickythefox
Last active December 2, 2021 15:48
Show Gist options
  • Save rickythefox/8c6ff909a5c759d3ad3faf970766561f to your computer and use it in GitHub Desktop.
Save rickythefox/8c6ff909a5c759d3ad3faf970766561f to your computer and use it in GitHub Desktop.
Clean up long and ugly SSO username in AWS console
// ==UserScript==
// @name Cleanup AWS SSO username
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Fix long and ugly SSO username
// @author Richard Ginzburg
// @match https://*.console.aws.amazon.com/*
// @grant none
// @run-at document-end
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// ==/UserScript==
(function() {
'use strict';
const spans = document.getElementsByTagName('span')
const foundSpans = []
for (const s of spans) {
if (s.childElementCount === 0 && s.innerText && s.innerText.startsWith('AWSReservedSSO_')) {
foundSpans.push(s)
if (foundSpans.length === 2)
break
}
}
foundSpans[0].innerText = foundSpans[1].innerText.split('/')[1]
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment