Skip to content

Commit 46fa52f

Browse files
Login reroute fix (#210)
* Add function to get current user in session
1 parent 86b46ae commit 46fa52f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/main/resources/static/js/common.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ function checkLoggedInUser() {
276276
var contextPath = "/auth/login";
277277
ajaxHttpSender.sendAjax(contextPath, "GET", null, callback);
278278
}
279+
280+
function getCurrentUserInSession() {
281+
return sessionStorage.getItem("currentUser");
282+
}
279283
// End ## Login and Security ##
280284

281285
// Start ## Status Indicator ##

src/main/resources/static/js/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jQuery(document).ready(function () {
66
beforeSend: function () {
77
},
88
success: function (responseData, textStatus) {
9-
var currentUser = localStorage.getItem("currentUser");
9+
var currentUser = getCurrentUserInSession();
1010
var ldapEnabled = responseData.security;
1111
if (ldapEnabled == false || (ldapEnabled == true && currentUser != null)) {
1212
router.navigate('subscriptions');

src/main/resources/static/js/subscription.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ jQuery(document).ready(function () {
512512
}
513513

514514
// Check if current user is logged in
515-
var currentUser = sessionStorage.getItem("currentUser");
515+
var currentUser = getCurrentUserInSession();
516516
var isCurrentUserLoggedIn = isUserNameDefined(currentUser)
517517
if (isCurrentUserLoggedIn == false) {
518518
// Current user is not logged in

0 commit comments

Comments
 (0)