feat: handle disabled auth strategies

This commit is contained in:
NGPixel
2020-09-05 18:33:15 -04:00
parent 715364de1d
commit 8490fc1267
7 changed files with 113 additions and 71 deletions

View File

@@ -277,6 +277,10 @@ module.exports = class User extends Model {
static async login (opts, context) {
if (_.has(WIKI.auth.strategies, opts.strategy)) {
const selStrategy = _.get(WIKI.auth.strategies, opts.strategy)
if (!selStrategy.isEnabled) {
throw new WIKI.Error.AuthProviderInvalid()
}
const strInfo = _.find(WIKI.data.authentication, ['key', selStrategy.strategyKey])
// Inject form user/pass