amnah\yii2\user\models\User::confirm PHP Method

confirm() public method

Confirm user email
public confirm ( string $newEmail ) : boolean
$newEmail string
return boolean
    public function confirm($newEmail)
    {
        // update status
        $this->status = static::STATUS_ACTIVE;
        // process $newEmail from a userToken
        //   check if another user already has that email
        $success = true;
        if ($newEmail) {
            $checkUser = static::findOne(["email" => $newEmail]);
            if ($checkUser) {
                $success = false;
            } else {
                $this->email = $newEmail;
            }
        }
        $this->save(false, ["email", "status"]);
        return $success;
    }