info-library 2.10.59 → 2.10.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/info-library.umd.js +57 -47
- package/bundles/info-library.umd.js.map +1 -1
- package/bundles/info-library.umd.min.js +1 -1
- package/bundles/info-library.umd.min.js.map +1 -1
- package/esm2015/controls/autocomplete/autocomplete.component.js +2 -2
- package/esm2015/service/authentication.service.js +59 -49
- package/fesm2015/info-library.js +59 -49
- package/fesm2015/info-library.js.map +1 -1
- package/info-library.metadata.json +1 -1
- package/package.json +1 -1
- package/service/authentication.service.d.ts +2 -1
|
@@ -1529,7 +1529,7 @@
|
|
|
1529
1529
|
this._modal = _modal;
|
|
1530
1530
|
this._key = 'token';
|
|
1531
1531
|
this._keySessao = 'sessao';
|
|
1532
|
-
this.
|
|
1532
|
+
this._sessionActive = true;
|
|
1533
1533
|
}
|
|
1534
1534
|
/**
|
|
1535
1535
|
* @return {?}
|
|
@@ -1550,13 +1550,17 @@
|
|
|
1550
1550
|
*/
|
|
1551
1551
|
InfoAuthenticationService.prototype.canActivate = function (activatedRouteSnapshot, routerStateSnapshot) {
|
|
1552
1552
|
var _this = this;
|
|
1553
|
-
if (!this.isLogged()) {
|
|
1553
|
+
if (!this.isLogged() || !this._sessionActive) {
|
|
1554
1554
|
this.logout();
|
|
1555
1555
|
return true;
|
|
1556
1556
|
}
|
|
1557
1557
|
/** @type {?} */
|
|
1558
1558
|
var url = activatedRouteSnapshot.data['URL'] || routerStateSnapshot.url;
|
|
1559
|
-
|
|
1559
|
+
setTimeout(( /**
|
|
1560
|
+
* @return {?}
|
|
1561
|
+
*/function () {
|
|
1562
|
+
_this.refreshSessionTime();
|
|
1563
|
+
}), 1000);
|
|
1560
1564
|
this.definePaginaAtiva(url);
|
|
1561
1565
|
return this.getPermission(url, true)
|
|
1562
1566
|
.pipe(operators.map(( /**
|
|
@@ -1618,51 +1622,57 @@
|
|
|
1618
1622
|
*/
|
|
1619
1623
|
InfoAuthenticationService.prototype.refreshSessionTime = function () {
|
|
1620
1624
|
var _this = this;
|
|
1625
|
+
if (!this._sessionActive)
|
|
1626
|
+
return;
|
|
1621
1627
|
clearInterval(this._sessionTimeInterval);
|
|
1622
|
-
if (this._sessao.TempoInatividade <= 0)
|
|
1623
|
-
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1628
|
+
if (this._sessao.TempoInatividade == null || this._sessao.TempoInatividade <= 0)
|
|
1629
|
+
return;
|
|
1630
|
+
/** @type {?} */
|
|
1631
|
+
var tempoSessao = this._sessao.TempoInatividade;
|
|
1632
|
+
localStorage.setItem('ms', new Date().valueOf().toString());
|
|
1633
|
+
this._sessionTimeInterval = setInterval(( /**
|
|
1634
|
+
* @return {?}
|
|
1635
|
+
*/function () {
|
|
1636
|
+
if (tempoSessao > 0) {
|
|
1637
|
+
tempoSessao--;
|
|
1629
1638
|
return;
|
|
1630
1639
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1640
|
+
/** @type {?} */
|
|
1641
|
+
var tempoRestante = Math.round(_this._sessao.TempoInatividade - ((new Date().valueOf() - parseInt(localStorage.getItem('ms'))) / 1000));
|
|
1642
|
+
if (!isNaN(tempoRestante) && tempoRestante > 0) {
|
|
1643
|
+
tempoSessao = tempoRestante;
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
clearInterval(_this._sessionTimeInterval);
|
|
1647
|
+
_this._sessionActive = false;
|
|
1648
|
+
if (isNaN(tempoRestante))
|
|
1649
|
+
_this.logout();
|
|
1650
|
+
else
|
|
1651
|
+
_this.showMessage();
|
|
1652
|
+
}), 1000);
|
|
1653
|
+
};
|
|
1654
|
+
/**
|
|
1655
|
+
* @return {?}
|
|
1656
|
+
*/
|
|
1657
|
+
InfoAuthenticationService.prototype.showMessage = function () {
|
|
1658
|
+
var _this = this;
|
|
1659
|
+
/** @type {?} */
|
|
1660
|
+
var ref = this._modal.open(RefreshSessionTimeModalComponent, {
|
|
1661
|
+
data: null,
|
|
1662
|
+
disableClose: true,
|
|
1663
|
+
width: '500px'
|
|
1664
|
+
});
|
|
1665
|
+
ref.afterClosed().subscribe(( /**
|
|
1666
|
+
* @param {?} r
|
|
1667
|
+
* @return {?}
|
|
1668
|
+
*/function (r) {
|
|
1669
|
+
if (r != null && (r.modalAction == InfoModalAction.Yes || (_this._sessao.TempoInatividade - ((new Date().valueOf() - parseInt(localStorage.getItem('ms'))) / 1000)) > 0)) {
|
|
1670
|
+
_this._sessionActive = true;
|
|
1671
|
+
_this.refreshSessionTime();
|
|
1672
|
+
}
|
|
1673
|
+
else
|
|
1674
|
+
_this.logout();
|
|
1675
|
+
}));
|
|
1666
1676
|
};
|
|
1667
1677
|
/**
|
|
1668
1678
|
* @param {?} usuario
|
|
@@ -2085,7 +2095,7 @@
|
|
|
2085
2095
|
* @type {?}
|
|
2086
2096
|
* @private
|
|
2087
2097
|
*/
|
|
2088
|
-
InfoAuthenticationService.prototype.
|
|
2098
|
+
InfoAuthenticationService.prototype._sessionActive;
|
|
2089
2099
|
/**
|
|
2090
2100
|
* @type {?}
|
|
2091
2101
|
* @private
|
|
@@ -2541,7 +2551,7 @@
|
|
|
2541
2551
|
* @return {?}
|
|
2542
2552
|
*/function () {
|
|
2543
2553
|
if (_this.selectedValue != null)
|
|
2544
|
-
if (_this._data == null || (_this._data != null && _this._data.length == 0)) {
|
|
2554
|
+
if ((_this._data == null || (_this._data != null && _this._data.length == 0)) && !_this.loading) {
|
|
2545
2555
|
_this.writeValue(null);
|
|
2546
2556
|
_this.selectedValue = null;
|
|
2547
2557
|
}
|