diff options
Diffstat (limited to 'models/settings.js')
-rw-r--r-- | models/settings.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/models/settings.js b/models/settings.js index c2a9bf01..6c9f5a53 100644 --- a/models/settings.js +++ b/models/settings.js @@ -76,6 +76,7 @@ if (Meteor.isServer) { }, createdAt: now, modifiedAt: now}; Settings.insert(defaultSetting); } + const newSetting = Settings.findOne(); if (!process.env.MAIL_URL && newSetting.mailUrl()) process.env.MAIL_URL = newSetting.mailUrl(); @@ -235,5 +236,35 @@ if (Meteor.isServer) { cas: isCasEnabled(), }; }, + + getDefaultAuthenticationMethod() { + return process.env.DEFAULT_AUTHENTICATION_METHOD; + }, + + // TODO: patch error : did not check all arguments during call + logoutWithTimer(userId) { + if (process.env.LOGOUT_WITH_TIMER) { + Jobs.run('logOut', userId, { + in: { + days: process.env.LOGOUT_IN, + }, + on: { + hour: process.env.LOGOUT_ON_HOURS, + minute: process.env.LOGOUT_ON_MINUTES, + }, + priority: 1, + }); + } + }, + }); + + Jobs.register({ + logOut(userId) { + Meteor.users.update( + {_id: userId}, + {$set: {'services.resume.loginTokens': []}} + ); + this.success(); + }, }); } |