Skip to content

Commit

Permalink
Merge pull request #2437 from AlexanderS/fix-hal-login-form
Browse files Browse the repository at this point in the history
[DS-4259] HAL login form does not support special characters
  • Loading branch information
tdonohue committed Jun 11, 2019
2 parents a7a8545 + 812b459 commit 62de82f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dspace-spring-rest/src/main/webapp/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
</head>
<body>
<div class="container">
<form class="form-signin">
<form id="login-form" class="form-signin">
<h2 class="form-signin-heading">HAL Browser</h2>
<input type="text" class="input-block-level" placeholder="Username" id="username">
<input type="password" class="input-block-level" placeholder="Password" id="password">
<button type="button" class="btn btn-large btn-primary" id="login">Sign in</button>
<button type="submit" class="btn btn-large btn-primary" id="login">Sign in</button>
<div class="other-login-methods hidden">
<h3>Other login methods:</h3>

Expand Down Expand Up @@ -133,13 +133,13 @@ <h3>Other login methods:</h3>
return string.charAt(0).toUpperCase() + string.slice(1);
}

$("#login").click(function() {
$("#login-form").submit(function() {
$.ajax({
//This depends on this file to be called login.html
url : window.location.href.replace("login.html", "") + 'api/authn/login',
type : 'POST',
async : false,
data : 'password='+$("#password").val()+'&user='+$("#username").val() ,
data : 'password='+encodeURIComponent($("#password").val())+'&user='+encodeURIComponent($("#username").val()),
headers : {
"Content-Type" : 'application/x-www-form-urlencoded',
"Accept:" : '*/*'
Expand All @@ -149,6 +149,8 @@ <h3>Other login methods:</h3>
toastr.error('The credentials you entered are invalid. Please try again.', 'Login Failed');
}
});

return false;
});
});
</script>
Expand Down

0 comments on commit 62de82f

Please sign in to comment.