@@ 198-200 (lines=3) @@ | ||
195 | return ['_error' => 'mfa already enabled' . $secret]; |
|
196 | } |
|
197 | ||
198 | if (!$this->module->getTotp()->verifyCode($identity->getTemporarySecret(), \Yii::$app->request->post()['code'] ?? '')) { |
|
199 | return ['_error' => 'invalid totp code']; |
|
200 | } |
|
201 | ||
202 | $identity->setTotpSecret($identity->getTemporarySecret()); |
|
203 | $identity->setTemporarySecret(null); |
|
@@ 218-220 (lines=3) @@ | ||
215 | return ['_error' => 'mfa disabled, enable first']; |
|
216 | } |
|
217 | ||
218 | if (!$this->module->getTotp()->verifyCode($secret, \Yii::$app->request->post()['code'] ?? '')) { |
|
219 | return ['_error' => 'invalid totp code']; |
|
220 | } |
|
221 | ||
222 | $identity->setTotpSecret(''); |
|
223 | $identity->save(); |