forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove flux store usages from utils (mattermost#1952)
- Loading branch information
1 parent
c6b4c00
commit 68f3c58
Showing
6 changed files
with
90 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
import assert from 'assert'; | ||
|
||
import {checkIfMFARequired} from 'utils/route'; | ||
|
||
describe('Utils.Route', function() { | ||
describe('checkIfMFARequired', () => { | ||
test('mfa is enforced', () => { | ||
const user = {mfa_active: false, auth_service: ''}; | ||
const config = {EnableMultifactorAuthentication: 'true', EnforceMultifactorAuthentication: 'true'}; | ||
const license = {MFA: 'true'}; | ||
|
||
assert.ok(checkIfMFARequired(user, license, config, '')); | ||
assert.ok(!checkIfMFARequired(user, license, config, '/mfa/setup')); | ||
assert.ok(!checkIfMFARequired(user, license, config, '/mfa/confirm')); | ||
|
||
user.auth_service = 'email'; | ||
assert.ok(checkIfMFARequired(user, license, config, '')); | ||
|
||
user.auth_service = 'ldap'; | ||
assert.ok(checkIfMFARequired(user, license, config, '')); | ||
|
||
user.auth_service = 'saml'; | ||
assert.ok(!checkIfMFARequired(user, license, config, '')); | ||
|
||
user.auth_service = ''; | ||
user.mfa_active = true; | ||
assert.ok(!checkIfMFARequired(user, license, config, '')); | ||
}); | ||
|
||
test('mfa is not enforced or enabled', () => { | ||
const user = {mfa_active: false, auth_service: ''}; | ||
const config = {EnableMultifactorAuthentication: 'true', EnforceMultifactorAuthentication: 'false'}; | ||
const license = {MFA: 'true'}; | ||
assert.ok(!checkIfMFARequired(user, license, config, '')); | ||
|
||
config.EnforceMultifactorAuthentication = 'true'; | ||
config.EnableMultifactorAuthentication = 'false'; | ||
assert.ok(!checkIfMFARequired(user, license, config, '')); | ||
|
||
license.MFA = 'false'; | ||
config.EnableMultifactorAuthentication = 'true'; | ||
assert.ok(!checkIfMFARequired(user, license, config, '')); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters