x x x
x
Only portrait mode is currently supported - please rotate your device.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

HTML
<script>

let usernameFromParam = getQueryParameterByName("username");

const getGroupsForUser = async (username) => {
  let res = await jQuery.ajax({
    url: "/rest/api/user/memberof?username=" + username,
    type: "get",
    dataType: 'json',
	headers: {
      "X-Atlassian-Token": "nocheck",
      "Content-type": "application/json",
    }
  });

  let groups = [];
  if (res && res.results && res.results.length > 0) {
    groups = res.results.map(group => group.name);
  }

  return groups;
}

if (usernameFromParam) {
  getGroupsForUser(usernameFromParam).then(groups => {
    if (!AJS.params.remoteUser && AJS.params.spaceKey.toLowerCase() == "msa") {
      // If user is NOT logged in and on MSA reset password page
      if (groups.includes('mssba-users') && !groups.includes('morganstanley-users')) {
        // If username is in SBA group but not MCIL user
        window.location.replace("/display/SBAAN/Reset+User+Password" + window.location.search);
      }
    }
  })
}

</script>

...