diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-11-16 21:26:07 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-11-16 21:26:07 +0200 |
commit | 033a9482fc7f765963f55e9dbd82d32b91970b74 (patch) | |
tree | 5a3313d72a57094edfdded9ae6888a81482ceec3 /models | |
parent | 73daf191ae15591bdf7fa71446a636460c482d6e (diff) | |
parent | 893329d9c6d33aa5572e268e8f951400a2446303 (diff) | |
download | wekan-033a9482fc7f765963f55e9dbd82d32b91970b74.tar.gz wekan-033a9482fc7f765963f55e9dbd82d32b91970b74.tar.bz2 wekan-033a9482fc7f765963f55e9dbd82d32b91970b74.zip |
Merge branch 'devel' of https://github.com/Akuket/wekan into Akuket-devel
Diffstat (limited to 'models')
-rw-r--r-- | models/settings.js | 31 | ||||
-rw-r--r-- | models/users.js | 8 |
2 files changed, 35 insertions, 4 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(); + }, }); } diff --git a/models/users.js b/models/users.js index 630f4703..2e879d94 100644 --- a/models/users.js +++ b/models/users.js @@ -520,10 +520,10 @@ if (Meteor.isServer) { } const disableRegistration = Settings.findOne().disableRegistration; - // If ldap, bypass the inviation code if the self registration isn't allowed. - // TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type - if (options.ldap || !disableRegistration) { - user.authenticationMethod = 'ldap'; + if (!disableRegistration) { + if (options.ldap) { + user.authenticationMethod = 'ldap'; + } return user; } |