mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
Add redirect behavior
This commit is contained in:
@@ -79,6 +79,26 @@
|
||||
"onclick" : function() { toastr.remove(); }
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : window.location.href.replace("login.html", "") + 'api/authn/login',
|
||||
success : function(result, status, xhr) {
|
||||
document.cookie = "MyHalBrowserToken=" + xhr.getResponseHeader('Authorization').split(" ")[1];
|
||||
toastr.success('You are now logged in. Please wait while we redirect you...', 'Login Successful');
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.pathname.replace("login.html", "");
|
||||
}, 2000);
|
||||
},
|
||||
error : function(result, status, xhr) {
|
||||
if (xhr == 401) {
|
||||
var loc = result.getResponseHeader("location");
|
||||
if (loc != null && loc != "") {
|
||||
document.location = loc;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#login").click(function() {
|
||||
$.ajax({
|
||||
//This depends on this file to be called login.html
|
||||
|
Reference in New Issue
Block a user