2017-01-21 04:24:30 +05:30
|
|
|
<?php
|
|
|
|
namespace tests\codeception\api\_pages;
|
|
|
|
|
|
|
|
use yii\codeception\BasePage;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @property \tests\codeception\api\FunctionalTester $actor
|
|
|
|
*/
|
|
|
|
class TwoFactorAuthRoute extends BasePage {
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function credentials(int $accountId) {
|
|
|
|
$this->setRoute($accountId);
|
2017-01-21 04:24:30 +05:30
|
|
|
$this->actor->sendGET($this->getUrl());
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function enable(int $accountId, $totp = null, $password = null) {
|
|
|
|
$this->setRoute($accountId);
|
2017-01-23 04:37:29 +05:30
|
|
|
$this->actor->sendPOST($this->getUrl(), [
|
2017-09-06 22:47:52 +05:30
|
|
|
'totp' => $totp,
|
2017-01-23 04:37:29 +05:30
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
public function disable(int $accountId, $totp = null, $password = null) {
|
|
|
|
$this->setRoute($accountId);
|
2017-01-23 04:37:29 +05:30
|
|
|
$this->actor->sendDELETE($this->getUrl(), [
|
2017-09-06 22:47:52 +05:30
|
|
|
'totp' => $totp,
|
2017-01-23 04:37:29 +05:30
|
|
|
'password' => $password,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2017-09-19 22:36:16 +05:30
|
|
|
private function setRoute(int $accountId) {
|
|
|
|
$this->route = "/v1/accounts/{$accountId}/two-factor-auth";
|
|
|
|
}
|
|
|
|
|
2017-01-21 04:24:30 +05:30
|
|
|
}
|