kreait / firebase-php

@@ -650,6 +650,38 @@
Loading
650 650
        }
651 651
    }
652 652
653 +
    /**
654 +
     * Confirm email verification.
655 +
     *
656 +
     * @param Uid|Email|string $uidOrEmail the user whose tokens are to be revoked
657 +
     *
658 +
     * @throws UserNotFound
659 +
     * @throws UserDisabled
660 +
     * @throws ExpiredOobCode
661 +
     * @throws InvalidOobCode
662 +
     * @throws OperationNotAllowed
663 +
     * @throws Exception\AuthException
664 +
     * @throws Exception\FirebaseException
665 +
     */
666 +
    public function confirmEmailVerification($uidOrEmail, string $oobCode): void
667 +
    {
668 +
        if (\is_string($uidOrEmail)) {
669 +
            try {
670 +
                $uidOrEmail = new Email($uidOrEmail);
671 +
            } catch (\InvalidArgumentException $e) {
672 +
                $uidOrEmail = new Uid((string) $uidOrEmail);
673 +
            }
674 +
        }
675 +
676 +
        if ($uidOrEmail instanceof Email) {
677 +
            $uid = $this->getUserByEmail($uidOrEmail)->uid;
678 +
        } else {
679 +
            $uid = $uidOrEmail;
680 +
        }
681 +
682 +
        $this->client->confirmEmailVerification((string) $uid, $oobCode);
683 +
    }
684 +
653 685
    /**
654 686
     * Revokes all refresh tokens for the specified user identified by the uid provided.
655 687
     * In addition to revoking all refresh tokens for a user, all ID tokens issued

@@ -167,6 +167,20 @@
Loading
167 167
        ]);
168 168
    }
169 169
170 +
    /**
171 +
     * @throws ExpiredOobCode
172 +
     * @throws InvalidOobCode
173 +
     * @throws OperationNotAllowed
174 +
     * @throws UserDisabled
175 +
     */
176 +
    public function confirmEmailVerification(string $uid, string $oobCode): ResponseInterface
177 +
    {
178 +
        return $this->requestApi('https://identitytoolkit.googleapis.com/v1/accounts:update', [
179 +
            'oobCode' => $oobCode,
180 +
            'localId' => $uid,
181 +
        ]);
182 +
    }
183 +
170 184
    /**
171 185
     * @throws AuthException
172 186
     * @throws FirebaseException
Files Complexity Coverage
src/Firebase 1,447 65.02%
Project Totals (147 files) 1447 65.02%
1
comment:
2
  layout: "reach,diff"
3

4
coverage:
5
  status:
6
    project:
7
      default:
8
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading