Web: Common: add session lifetime

This commit is contained in:
Viktor Fomin 2022-04-07 17:55:44 +03:00
parent 46b98bc243
commit 883cc628ea
3 changed files with 19 additions and 0 deletions

View File

@ -93,6 +93,13 @@ export function setCookieSettings(lifeTime) {
});
}
export function getCookieSettings() {
return request({
method: "get",
url: "/settings/cookiesettings.json",
});
}
export function setLifetimeAuditSettings(data) {
return request({
method: "post",

View File

@ -56,6 +56,7 @@ class AuthStore {
this.settingsStore.getPortalPasswordSettings();
this.tfaStore.getTfaType();
this.settingsStore.getIpRestrictions();
this.settingsStore.getSessionLifetime();
}
return Promise.all(requests);

View File

@ -33,6 +33,7 @@ class SettingsStore {
trustedDomainsType = 0;
ipRestrictionEnable = false;
ipRestrictions = [];
sessionLifetime = "1440";
timezone = "UTC";
timezones = [];
utcOffset = "00:00:00";
@ -480,6 +481,16 @@ class SettingsStore {
await api.settings.setMessageSettings(turnOn);
this.enableAdmMess = turnOn;
};
getSessionLifetime = async () => {
const res = await api.settings.getSessionLifetime();
this.sessionLifetime = res;
};
setSessionLifetimeSettings = async (lifeTime) => {
const res = await api.settings.setCookieSettings(lifeTime);
this.sessionLifetime = lifeTime;
};
}
export default SettingsStore;