| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 63 | public function verifyCode(): bool |
||
| 64 | { |
||
| 65 | $recoveryCodes = self::findAll(['user_id' => $this->getUser()]); |
||
| 66 | |||
| 67 | foreach ($recoveryCodes ?? [] as $recoveryCode){ |
||
| 68 | if (Yii::$app->getSecurity()->validatePassword($this->getCode(), $recoveryCode->getCode())){ |
||
| 69 | $recoveryCode->delete(); |
||
| 70 | return true; |
||
| 71 | } |
||
| 72 | } |
||
| 73 | |||
| 74 | return false; |
||
| 75 | } |
||
| 76 | |||
| 81 | } |