Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Merge branch 'pu/pm/AdminTestMFAUserConfigSave' into '2021.11'
Browse files Browse the repository at this point in the history
test(Admin) added save mfa user config test

See merge request tine20/tine20!2223
  • Loading branch information
paulmhh committed May 6, 2022
2 parents f82bcfb + 0419c99 commit 5df2656
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/tine20/Admin/Frontend/Json/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,30 @@ public function testUmlautDomainInAliases()
'aliases not correct: ' . print_r($updatedUser['emailUser'], true));
}

public function testSetMFA()
{
$this->_createAreaLockConfig();

$user = $this->_personas['sclever']->toArray();
$user['mfa_configs'] = [[
'id' => Tinebase_Record_Abstract::generateUID(),
Tinebase_Model_MFA_UserConfig::FLD_MFA_CONFIG_ID => 'pin',
Tinebase_Model_MFA_UserConfig::FLD_CONFIG_CLASS => Tinebase_Model_MFA_PinUserConfig::class,
Tinebase_Model_MFA_UserConfig::FLD_CONFIG => [
Tinebase_Model_MFA_PinUserConfig::FLD_PIN => '123456',
],
]];

$savedUser = $this->_json->saveUser($user);

$this->assertCount(1, $savedUser['mfa_configs']);
$this->assertEmpty($savedUser['mfa_configs'][0][Tinebase_Model_MFA_UserConfig::FLD_CONFIG]
[Tinebase_Model_MFA_PinUserConfig::FLD_PIN]);

$sclever = Tinebase_User::getInstance()->getFullUserById($savedUser['accountId']);
$this->assertNotEmpty($sclever->mfa_configs->getFirstRecord()->{Tinebase_Model_MFA_UserConfig::FLD_CONFIG}->getHashedPin());
}

/**
* test set expired status
*/
Expand Down

0 comments on commit 5df2656

Please sign in to comment.