Skip to content

Commit

Permalink
Remove tenant domain entering when entering username
Browse files Browse the repository at this point in the history
  • Loading branch information
ramindu90 committed Aug 11, 2023
1 parent 21ffb3e commit 834b67e
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions basicauth.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
// Handle form submission preventing double submission.
$(document).ready(function(){
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var callingTenant = "";
if (urlParams.get('tenantDomain') == "carbon.super") {
var stateValues = decodeURI(urlParams.get('state')).split("=");
callingTenant = stateValues[1];
if (callingTenant == "carbon.super") {
callingTenant = "";
}
}
$.fn.preventDoubleSubmission = function() {
$(this).on('submit',function(e){
var $form = $(this);
Expand Down Expand Up @@ -121,6 +131,15 @@
return this;
};
$('#loginForm').preventDoubleSubmission();
$('#usernamewithoutdomain').on("change", (event) => {
const usernameElement = document.getElementById("username");
if (callingTenant != null && callingTenant != "") {
usernameElement.value = event.target.value + "@" + callingTenant;
} else {
usernameElement.value = event.target.value;
}
}
);
});
</script>
Expand Down Expand Up @@ -307,11 +326,22 @@
<div class="field">
<div class="ui fluid left icon input">
<input
type="text"
type="hidden"
id="username"
value=""
name="username"
placeholder="<%=AuthenticationEndpointUtil.i18n(resourceBundle, usernameLabel)%>"
tabindex="1"
placeholder="<%=AuthenticationEndpointUtil.i18n(resourceBundle, "username")%>"
data-testid="login-page-username-input"
required>
<i aria-hidden="true" class="user icon"></i>
<input
type="text"
id="usernamewithoutdomain"
value=""
name="usernamewithoutdomain"
tabindex="1"
placeholder="<%=AuthenticationEndpointUtil.i18n(resourceBundle, "username")%>"
data-testid="login-page-username-input"
required>
<i aria-hidden="true" class="user icon"></i>
Expand Down

0 comments on commit 834b67e

Please sign in to comment.