Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
edulix committed Jun 20, 2024
1 parent 241df4b commit 5008214
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions avRegistration/auth-method-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ angular.module('avRegistration')
}

authmethod.setAuth = function(auth, isAdmin, autheventid) {
console.log("setAuth");
authmethod.admin = isAdmin;
$http.defaults.headers.common.Authorization = auth;
authmethod.lastAuthDate = new Date();
Expand All @@ -89,18 +88,15 @@ angular.module('avRegistration')

function newInteractionCallback()
{
console.log("newInteractionCallback..");
// Only try to renew token when it's older than 50% of
// the expiration time
var now = new Date();
var secsDiff = getSecondsDifference(authmethod.lastAuthDate, now);
var halfLife = ConfigService.authTokenExpirationSeconds * 0.5;
if (secsDiff <= halfLife) {
console.log("secsDiff <= halfLife, stopping..");
return;
}
authmethod.lastAuthDate = now;
console.log("secsDiff > halfLife, refreshing token..");
authmethod.refreshAuthToken(autheventid);
}

Expand Down
7 changes: 3 additions & 4 deletions dist/appCommon-v10.4.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ angular.module("avRegistration").config(function() {}), angular.module("avRegist
authevent;
}, authmethod.setAuth = function(auth, isAdmin, autheventid) {
var callback;
if (console.log("setAuth"), authmethod.admin = isAdmin, $http.defaults.headers.common.Authorization = auth,
if (authmethod.admin = isAdmin, $http.defaults.headers.common.Authorization = auth,
authmethod.lastAuthDate = new Date(), !authmethod.iddleDetectionSetup) return authmethod.iddleDetectionSetup = !0,
callback = function() {
console.log("newInteractionCallback..");
var date1, date2, now = new Date();
(date1 = authmethod.lastAuthDate, date2 = now, Math.abs(date2 - date1) / 1e3) <= .5 * ConfigService.authTokenExpirationSeconds ? console.log("secsDiff <= halfLife, stopping..") : (authmethod.lastAuthDate = now,
console.log("secsDiff > halfLife, refreshing token.."), authmethod.refreshAuthToken(autheventid));
(date1 = authmethod.lastAuthDate, date2 = now, Math.abs(date2 - date1) / 1e3) <= .5 * ConfigService.authTokenExpirationSeconds || (authmethod.lastAuthDate = now,
authmethod.refreshAuthToken(autheventid));
}, [ "click", "keypress", "mousemove", "mousedown", "touchstart", "touchmove" ].forEach(function(event) {
document.addEventListener(event, callback);
}), !1;
Expand Down

0 comments on commit 5008214

Please sign in to comment.