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 checkSBAGroupMembership = async (username) => {
  let res = await jQuery.ajax({
    url: "/rest/scriptrunner/latest/custom/checkGroupMembershipAnonymous",
    type: "POST",
    dataType: 'json',
	headers: {
      "X-Atlassian-Token": "nocheck",
      "Content-type": "application/json",
    },
 	data: JSON.stringify({username: usernameFromParam, group: 'mssba-users'})
  });

  return res;
}
*/
const checkGroupMembership = async (username, groupName) => {
  let res = await jQuery.ajax({
    url: "/rest/scriptrunner/latest/custom/checkGroupMembershipAnonymous",
    type: "POST",
    dataType: 'json',
	headers: {
      "X-Atlassian-Token": "nocheck",
      "Content-type": "application/json",
    },
 	data: JSON.stringify({username: usernameFromParam, group: groupName})
  });

  return res;
}  

if (usernameFromParam && !AJS.params.remoteUser) {   
	checkGroupMembership(usernameFromParam,'ms-sustainability-users').then(res0 => {
    if (AJS.params.spaceKey.toLowerCase() == "msa") {
      // If user is NOT logged in and on MSA reset password page
      if (res0 === true) {
        // If username is in SBA group
        window.location.replace("/display/MSSA/Reset+User+Password" + window.location.search);
      } else {
        checkGroupMembership(usernameFromParam,'mssba-users').then(res => {
          if (AJS.params.spaceKey.toLowerCase() == "msa") {
            // If user is NOT logged in and on MSA reset password page
            if (res === true) {
              // If username is in SBA group
              window.location.replace("/display/SBAAN/Reset+User+Password" + window.location.search);
            } else {
        		checkGroupMembership(usernameFromParam,'msia-users').then(res2 => {
			            if (res2 === true) {
			 	               window.location.replace("/display/InnovationAwards/Reset+User+Password" + window.location.search);
			}
		});
	            }
          });
          }
          }
        })
      }
    }
  })
}

</script>


HTML
<style>
body.login #rw_wrapper #rw_main div#main{
	display: flex!important;
    flex-direction: column!important;
    align-items: center!important;
}

.forgot-iframe-container {
    display: flex;
    justify-content: center;
}

.forgot-iframe-container #forgot-password-iframe {
	width: 100%;
    height: 100vh;
	display: none;
}

div#custom-footer {
    display: none;
}

div#rw_theme_header {
    display: none !important;
}


@media only screen and (max-width: 600px) {
 div#postiontoggle {
    display: none;
}

.add-margin-mobile {
     margin-top: unset !important;
 }
}

</style>

<div class="forgot-iframe-container"> 
<iframe id="forgot-password-iframe"  title="" src="#"> </iframe>
<script>
document.getElementById('forgot-password-iframe').src = "/resetuserpassword.action?" + window.location.href.split('?')[1];
</script>
</div>

<script>

$("#forgot-password-iframe").on("load", function() {
  let head = $("#forgot-password-iframe").contents().find("head");

  var iframe = document.getElementById("forgot-password-iframe");
  var elmnt = iframe.contentWindow.document.querySelector("input.aui-button.aui-style.aui-button-primary");
 // elmnt.onclick = function() {window.location.href = "/display/MSA/Password+Reset+Successful";}


	console.log("iframe content window")
	console.log(iframe.contentWindow.document)
	if(iframe.contentWindow.document.querySelector('.userpassword-section').innerText.includes("Your password has been reset")){
 window.location.href = "/display/MSA/Password+Reset+Successful";
	}


  let css = `<style>
		
body.login .rw_background_top div.rw_login_logo {display: none;}

#full-height-container, #page, body, html {
    height: auto !important;
}

html {
    background: #fafafa;
}

div#custom-footer {
    display: none;
}

body.login div#rw_wrapper {
    background: white;
}

div#login-container {
    font-family: 'Arimo';
}


input.aui-button.aui-style.aui-button-primary {
    border-radius: 8px !important;
    background-color: var(--primary-color) !important;
    
    font-family: Arimo !important;
    font-size: 12px !important;
    
    font-weight: bold !important;

    border: unset !important;
    line-height: 2 !important;
    letter-spacing: 1.19px !important;
    
    color: white !important;
    
}

a.aui-button.aui-style.aui-button-link {
    display: none;
}

body.login form fieldset div.field-group label {
    font-family: Arimo;
}

body.login div#rw_main {
    padding: 100px;
}


	</style>`;
  $(head).append(css);

$('#forgot-password-iframe').show()
});

</script>

...