unify totp check
the totp check is done in several places causing errors like 3552232e99
* ldap (addon)
* accesscontrol (dashboard)
* proxyauth
* directoryserver (exposed ldap)
* externalldap (the connector)
The code also makes externalldap auto-create work now across all the cases where there is a username
This commit is contained in:
@@ -54,25 +54,25 @@ describe('App passwords', function () {
|
||||
});
|
||||
|
||||
it('can verify app password', async function () {
|
||||
const result = await users.verify(admin.id, password, 'appid');
|
||||
const result = await users.verify(admin.id, password, 'appid', {});
|
||||
expect(result).to.be.ok();
|
||||
expect(result.appPassword).to.be(true);
|
||||
});
|
||||
|
||||
it('can verify non-app password', async function () {
|
||||
const result = await users.verify(admin.id, admin.password, 'appid');
|
||||
const result = await users.verify(admin.id, admin.password, 'appid', {});
|
||||
expect(result).to.be.ok();
|
||||
expect(result.appPassword).to.be(undefined);
|
||||
});
|
||||
|
||||
it('cannot verify bad password', async function () {
|
||||
const [error, result] = await safe(users.verify(admin.id, 'bad', 'appid'));
|
||||
const [error, result] = await safe(users.verify(admin.id, 'bad', 'appid', {}));
|
||||
expect(result).to.not.be.ok();
|
||||
expect(error.reason).to.be(BoxError.INVALID_CREDENTIALS);
|
||||
});
|
||||
|
||||
it('cannot verify password for another app', async function () {
|
||||
const [error, result] = await safe(users.verify(admin.id, password, 'appid2'));
|
||||
const [error, result] = await safe(users.verify(admin.id, password, 'appid2', {}));
|
||||
expect(result).to.not.be.ok();
|
||||
expect(error.reason).to.be(BoxError.INVALID_CREDENTIALS);
|
||||
});
|
||||
@@ -82,7 +82,7 @@ describe('App passwords', function () {
|
||||
});
|
||||
|
||||
it('cannot verify deleted app password', async function () {
|
||||
const [error] = await safe(users.verify(admin.id, password, 'appid'));
|
||||
const [error] = await safe(users.verify(admin.id, password, 'appid', {}));
|
||||
expect(error.reason).to.be(BoxError.INVALID_CREDENTIALS);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user