Plugin Directory

Changeset 2594222


Ignore:
Timestamp:
09/06/2021 11:13:58 AM (5 years ago)
Author:
2fas
Message:

Release v3.0.6

Location:
2fas/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • 2fas/trunk/changelog.txt

    r2551311 r2594222  
    11== Changelog ==
     2
     3= 3.0.6 (Sep. 6, 2021) =
     4* Removed old migration
     5* Updated Account SDK to 4.3
    26
    37= 3.0.5 (Jun. 21, 2021) =
  • 2fas/trunk/constants.php

    r2551311 r2594222  
    1515define( 'TWOFAS_TEMPLATES_PATH', $templates_path );
    1616define( 'TWOFAS_WP_ADMIN_PATH', $admin_url );
    17 define( 'TWOFAS_PLUGIN_VERSION', '3.0.5' );
     17define( 'TWOFAS_PLUGIN_VERSION', '3.0.6' );
    1818define( 'TWOFAS_DEPRECATE_PHP_OLDER_THAN', '5.6' );
  • 2fas/trunk/readme.txt

    r2551311 r2594222  
    33Tags: 2FA, 2 factor authentication, 2-fa, 2-step verification, 2fa wordpress, two factor authentication, security, multifactor authentication, google authenticator, token, otp, totp
    44Requires at least: 4.2
    5 Tested up to: 5.7
     5Tested up to: 5.8
    66Requires PHP: 5.6
    77Stable tag: trunk
     
    132132== Changelog ==
    133133
     134= 3.0.6 (Sep. 6, 2021) =
     135* Removed old migration
     136* Updated Account SDK to 4.3
     137
    134138= 3.0.5 (Jun. 21, 2021) =
    135139* Added user migration to 2FAS Prime plugin
  • 2fas/trunk/src/Http/Controllers/Admin/Account_Controller.php

    r2343404 r2594222  
    157157    private function render_account_view( $template_name ) {
    158158        try {
     159            $this->render_prime_info();
    159160            $email = $this->storage->get_user_storage()->get_email();
    160161
     
    169170        }
    170171    }
     172
     173    private function render_prime_info() {
     174        $message = "<div class='notice notice-info info'>
     175            <p>If you want to go beyond the basic plugin. Go for our upgraded plugin 2FAS Prime. <br />
     176            Advantages of 2FAS Prime plugin:
     177            <ul>
     178                <li>- No registration required</li>
     179                <li>- Easy to set up</li>
     180                <li>- Simple to use</li>
     181                <li>- Free</li>
     182            </ul>
     183            </p>
     184        </div>";
     185
     186        add_action( 'admin_notices', function () use ($message) {
     187            echo $message;
     188        }, 20 );
     189    }
    171190}
  • 2fas/trunk/src/Integration/API_Wrapper.php

    r2343404 r2594222  
    408408
    409409    /**
    410      * @param Integration $integration
    411      *
    412      * @return Integration
    413      *
    414      * @throws Account_Exception
    415      * @throws Account_Validation_Exception
    416      */
    417     public function reset_integration_encryption_keys( Integration $integration ) {
    418         return $this->account()->resetIntegrationEncryptionKeys( $integration );
    419     }
    420 
    421     /**
    422410     * @param string $email
    423411     * @param string $password
  • 2fas/trunk/src/Update/Migrations/Migration_0000_00_05_Reset_Integration_Encryption_Keys.php

    r2054497 r2594222  
    3333    public function up() {
    3434        try {
    35             $this->api_wrapper->reset_integration_encryption_keys( $this->get_integration() );
    3635        } catch ( TokenNotFoundException $e ) {
    3736
  • 2fas/trunk/twofas.php

    r2551311 r2594222  
    44 * Plugin URI:  https://wordpress.org/plugins/2fas/
    55 * Description: 2FAS strengthens WordPress admin security by requiring an additional verification code on untrusted devices.
    6  * Version:     3.0.5
     6 * Version:     3.0.6
    77 * Author:      Two Factor Authentication Service Inc.
    88 * Author URI:  https://2fas.com
  • 2fas/trunk/vendor/composer/ClassLoader.php

    r2470780 r2594222  
    4343class ClassLoader
    4444{
     45    private $vendorDir;
     46
    4547    // PSR-4
    4648    private $prefixLengthsPsr4 = array();
     
    5759    private $missingClasses = array();
    5860    private $apcuPrefix;
     61
     62    private static $registeredLoaders = array();
     63
     64    public function __construct($vendorDir = null)
     65    {
     66        $this->vendorDir = $vendorDir;
     67    }
    5968
    6069    public function getPrefixes()
     
    301310    {
    302311        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
     312
     313        if (null === $this->vendorDir) {
     314            return;
     315        }
     316
     317        if ($prepend) {
     318            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
     319        } else {
     320            unset(self::$registeredLoaders[$this->vendorDir]);
     321            self::$registeredLoaders[$this->vendorDir] = $this;
     322        }
    303323    }
    304324
     
    309329    {
    310330        spl_autoload_unregister(array($this, 'loadClass'));
     331
     332        if (null !== $this->vendorDir) {
     333            unset(self::$registeredLoaders[$this->vendorDir]);
     334        }
    311335    }
    312336
     
    315339     *
    316340     * @param  string    $class The name of the class
    317      * @return bool|null True if loaded, null otherwise
     341     * @return true|null True if loaded, null otherwise
    318342     */
    319343    public function loadClass($class)
     
    324348            return true;
    325349        }
     350
     351        return null;
    326352    }
    327353
     
    366392
    367393        return $file;
     394    }
     395
     396    /**
     397     * Returns the currently registered loaders indexed by their corresponding vendor directories.
     398     *
     399     * @return self[]
     400     */
     401    public static function getRegisteredLoaders()
     402    {
     403        return self::$registeredLoaders;
    368404    }
    369405
  • 2fas/trunk/vendor/composer/InstalledVersions.php

    r2551311 r2594222  
    11<?php
    22
     3/*
     4 * This file is part of Composer.
     5 *
     6 * (c) Nils Adermann <naderman@naderman.de>
     7 *     Jordi Boggiano <j.boggiano@seld.be>
     8 *
     9 * For the full copyright and license information, please view the LICENSE
     10 * file that was distributed with this source code.
     11 */
     12
    313namespace Composer;
    414
     15use Composer\Autoload\ClassLoader;
    516use Composer\Semver\VersionParser;
    617
    7 
    8 
    9 
    10 
    11 
     18/**
     19 * This class is copied in every Composer installed project and available to all
     20 *
     21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
     22 *
     23 * To require it's presence, you can require `composer-runtime-api ^2.0`
     24 */
    1225class InstalledVersions
    1326{
    14 private static $installed = array (
    15   'root' =>
    16   array (
    17     'pretty_version' => 'dev-master',
    18     'version' => 'dev-master',
    19     'aliases' =>
    20     array (
    21     ),
    22     'reference' => 'a1045640303c37ec14e37b68208849426b53b14c',
    23     'name' => 'twofas/twofas-wp-plugin',
    24   ),
    25   'versions' =>
    26   array (
    27     'container-interop/container-interop' =>
    28     array (
    29       'pretty_version' => '1.2.0',
    30       'version' => '1.2.0.0',
    31       'aliases' =>
    32       array (
    33       ),
    34       'reference' => '79cbf1341c22ec75643d841642dd5d6acd83bdb8',
    35     ),
    36     'container-interop/container-interop-implementation' =>
    37     array (
    38       'provided' =>
    39       array (
    40         0 => '^1.0',
    41       ),
    42     ),
    43     'endroid/qr-code' =>
    44     array (
    45       'pretty_version' => '1.6.6',
    46       'version' => '1.6.6.0',
    47       'aliases' =>
    48       array (
    49       ),
    50       'reference' => 'cef5d5b7b904d7bb0708eb744c35316364b65fa0',
    51     ),
    52     'mnapoli/php-di' =>
    53     array (
    54       'replaced' =>
    55       array (
    56         0 => '*',
    57       ),
    58     ),
    59     'php-di/invoker' =>
    60     array (
    61       'pretty_version' => '1.3.3',
    62       'version' => '1.3.3.0',
    63       'aliases' =>
    64       array (
    65       ),
    66       'reference' => '1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7',
    67     ),
    68     'php-di/php-di' =>
    69     array (
    70       'pretty_version' => '5.4.6',
    71       'version' => '5.4.6.0',
    72       'aliases' =>
    73       array (
    74       ),
    75       'reference' => '3f9255659595f3e289f473778bb6c51aa72abbbd',
    76     ),
    77     'php-di/phpdoc-reader' =>
    78     array (
    79       'pretty_version' => '2.1.1',
    80       'version' => '2.1.1.0',
    81       'aliases' =>
    82       array (
    83       ),
    84       'reference' => '15678f7451c020226807f520efb867ad26fbbfcf',
    85     ),
    86     'psr/cache' =>
    87     array (
    88       'pretty_version' => '1.0.1',
    89       'version' => '1.0.1.0',
    90       'aliases' =>
    91       array (
    92       ),
    93       'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
    94     ),
    95     'psr/container' =>
    96     array (
    97       'pretty_version' => '1.0.0',
    98       'version' => '1.0.0.0',
    99       'aliases' =>
    100       array (
    101       ),
    102       'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
    103     ),
    104     'psr/container-implementation' =>
    105     array (
    106       'provided' =>
    107       array (
    108         0 => '^1.0',
    109       ),
    110     ),
    111     'sentry/sentry' =>
    112     array (
    113       'pretty_version' => '1.11.0',
    114       'version' => '1.11.0.0',
    115       'aliases' =>
    116       array (
    117       ),
    118       'reference' => '159eeaa02bb2ef8a8ec669f3c88e4bff7e6a7ffe',
    119     ),
    120     'symfony/polyfill-ctype' =>
    121     array (
    122       'pretty_version' => 'v1.19.0',
    123       'version' => '1.19.0.0',
    124       'aliases' =>
    125       array (
    126       ),
    127       'reference' => 'aed596913b70fae57be53d86faa2e9ef85a2297b',
    128     ),
    129     'twig/twig' =>
    130     array (
    131       'pretty_version' => 'v1.42.5',
    132       'version' => '1.42.5.0',
    133       'aliases' =>
    134       array (
    135       ),
    136       'reference' => '87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e',
    137     ),
    138     'twofas/account-sdk' =>
    139     array (
    140       'pretty_version' => 'v4.2.0',
    141       'version' => '4.2.0.0',
    142       'aliases' =>
    143       array (
    144       ),
    145       'reference' => 'ee9f2d361a747416e28c47fc6a44a1d3abe402f2',
    146     ),
    147     'twofas/encryption' =>
    148     array (
    149       'pretty_version' => 'v4.0.0',
    150       'version' => '4.0.0.0',
    151       'aliases' =>
    152       array (
    153       ),
    154       'reference' => '7be586110b276bd1059093ff5aa0fb6bf6f14913',
    155     ),
    156     'twofas/sdk' =>
    157     array (
    158       'pretty_version' => 'v7.2.0',
    159       'version' => '7.2.0.0',
    160       'aliases' =>
    161       array (
    162       ),
    163       'reference' => 'd6a689aa8479e4f2d6a6a923e6e4c84fae25d829',
    164     ),
    165     'twofas/twofas-wp-plugin' =>
    166     array (
    167       'pretty_version' => 'dev-master',
    168       'version' => 'dev-master',
    169       'aliases' =>
    170       array (
    171       ),
    172       'reference' => 'a1045640303c37ec14e37b68208849426b53b14c',
    173     ),
    174     'twofas/validation-rules' =>
    175     array (
    176       'pretty_version' => 'v1.0.1',
    177       'version' => '1.0.1.0',
    178       'aliases' =>
    179       array (
    180       ),
    181       'reference' => '7a5c7126843d218623a8cffebfa4a22bd8ce157c',
    182     ),
    183     'twofas/wp-plugin-core' =>
    184     array (
    185       'pretty_version' => 'v3.0.1',
    186       'version' => '3.0.1.0',
    187       'aliases' =>
    188       array (
    189       ),
    190       'reference' => '9f125afdb62ca7442bc22deff602b212b7b2dd4d',
    191     ),
    192     'whichbrowser/parser' =>
    193     array (
    194       'pretty_version' => 'v2.1.2',
    195       'version' => '2.1.2.0',
    196       'aliases' =>
    197       array (
    198       ),
    199       'reference' => 'bcf642a1891032de16a5ab976fd352753dd7f9a0',
    200     ),
    201   ),
    202 );
    203 
    204 
    205 
    206 
    207 
    208 
    209 
    210 public static function getInstalledPackages()
    211 {
    212 return array_keys(self::$installed['versions']);
     27    private static $installed;
     28    private static $canGetVendors;
     29    private static $installedByVendor = array();
     30
     31    /**
     32     * Returns a list of all package names which are present, either by being installed, replaced or provided
     33     *
     34     * @return string[]
     35     * @psalm-return list<string>
     36     */
     37    public static function getInstalledPackages()
     38    {
     39        $packages = array();
     40        foreach (self::getInstalled() as $installed) {
     41            $packages[] = array_keys($installed['versions']);
     42        }
     43
     44        if (1 === \count($packages)) {
     45            return $packages[0];
     46        }
     47
     48        return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
     49    }
     50
     51    /**
     52     * Returns a list of all package names with a specific type e.g. 'library'
     53     *
     54     * @param  string   $type
     55     * @return string[]
     56     * @psalm-return list<string>
     57     */
     58    public static function getInstalledPackagesByType($type)
     59    {
     60        $packagesByType = array();
     61
     62        foreach (self::getInstalled() as $installed) {
     63            foreach ($installed['versions'] as $name => $package) {
     64                if (isset($package['type']) && $package['type'] === $type) {
     65                    $packagesByType[] = $name;
     66                }
     67            }
     68        }
     69
     70        return $packagesByType;
     71    }
     72
     73    /**
     74     * Checks whether the given package is installed
     75     *
     76     * This also returns true if the package name is provided or replaced by another package
     77     *
     78     * @param  string $packageName
     79     * @param  bool   $includeDevRequirements
     80     * @return bool
     81     */
     82    public static function isInstalled($packageName, $includeDevRequirements = true)
     83    {
     84        foreach (self::getInstalled() as $installed) {
     85            if (isset($installed['versions'][$packageName])) {
     86                return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     87            }
     88        }
     89
     90        return false;
     91    }
     92
     93    /**
     94     * Checks whether the given package satisfies a version constraint
     95     *
     96     * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
     97     *
     98     *   Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
     99     *
     100     * @param  VersionParser $parser      Install composer/semver to have access to this class and functionality
     101     * @param  string        $packageName
     102     * @param  string|null   $constraint  A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
     103     * @return bool
     104     */
     105    public static function satisfies(VersionParser $parser, $packageName, $constraint)
     106    {
     107        $constraint = $parser->parseConstraints($constraint);
     108        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
     109
     110        return $provided->matches($constraint);
     111    }
     112
     113    /**
     114     * Returns a version constraint representing all the range(s) which are installed for a given package
     115     *
     116     * It is easier to use this via isInstalled() with the $constraint argument if you need to check
     117     * whether a given version of a package is installed, and not just whether it exists
     118     *
     119     * @param  string $packageName
     120     * @return string Version constraint usable with composer/semver
     121     */
     122    public static function getVersionRanges($packageName)
     123    {
     124        foreach (self::getInstalled() as $installed) {
     125            if (!isset($installed['versions'][$packageName])) {
     126                continue;
     127            }
     128
     129            $ranges = array();
     130            if (isset($installed['versions'][$packageName]['pretty_version'])) {
     131                $ranges[] = $installed['versions'][$packageName]['pretty_version'];
     132            }
     133            if (array_key_exists('aliases', $installed['versions'][$packageName])) {
     134                $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
     135            }
     136            if (array_key_exists('replaced', $installed['versions'][$packageName])) {
     137                $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
     138            }
     139            if (array_key_exists('provided', $installed['versions'][$packageName])) {
     140                $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
     141            }
     142
     143            return implode(' || ', $ranges);
     144        }
     145
     146        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     147    }
     148
     149    /**
     150     * @param  string      $packageName
     151     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
     152     */
     153    public static function getVersion($packageName)
     154    {
     155        foreach (self::getInstalled() as $installed) {
     156            if (!isset($installed['versions'][$packageName])) {
     157                continue;
     158            }
     159
     160            if (!isset($installed['versions'][$packageName]['version'])) {
     161                return null;
     162            }
     163
     164            return $installed['versions'][$packageName]['version'];
     165        }
     166
     167        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     168    }
     169
     170    /**
     171     * @param  string      $packageName
     172     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
     173     */
     174    public static function getPrettyVersion($packageName)
     175    {
     176        foreach (self::getInstalled() as $installed) {
     177            if (!isset($installed['versions'][$packageName])) {
     178                continue;
     179            }
     180
     181            if (!isset($installed['versions'][$packageName]['pretty_version'])) {
     182                return null;
     183            }
     184
     185            return $installed['versions'][$packageName]['pretty_version'];
     186        }
     187
     188        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     189    }
     190
     191    /**
     192     * @param  string      $packageName
     193     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
     194     */
     195    public static function getReference($packageName)
     196    {
     197        foreach (self::getInstalled() as $installed) {
     198            if (!isset($installed['versions'][$packageName])) {
     199                continue;
     200            }
     201
     202            if (!isset($installed['versions'][$packageName]['reference'])) {
     203                return null;
     204            }
     205
     206            return $installed['versions'][$packageName]['reference'];
     207        }
     208
     209        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     210    }
     211
     212    /**
     213     * @param  string      $packageName
     214     * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
     215     */
     216    public static function getInstallPath($packageName)
     217    {
     218        foreach (self::getInstalled() as $installed) {
     219            if (!isset($installed['versions'][$packageName])) {
     220                continue;
     221            }
     222
     223            return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
     224        }
     225
     226        throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
     227    }
     228
     229    /**
     230     * @return array
     231     * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}
     232     */
     233    public static function getRootPackage()
     234    {
     235        $installed = self::getInstalled();
     236
     237        return $installed[0]['root'];
     238    }
     239
     240    /**
     241     * Returns the raw installed.php data for custom implementations
     242     *
     243     * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
     244     * @return array[]
     245     * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}
     246     */
     247    public static function getRawData()
     248    {
     249        @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
     250
     251        if (null === self::$installed) {
     252            // only require the installed.php file if this file is loaded from its dumped location,
     253            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     254            if (substr(__DIR__, -8, 1) !== 'C') {
     255                self::$installed = include __DIR__ . '/installed.php';
     256            } else {
     257                self::$installed = array();
     258            }
     259        }
     260
     261        return self::$installed;
     262    }
     263
     264    /**
     265     * Returns the raw data of all installed.php which are currently loaded for custom implementations
     266     *
     267     * @return array[]
     268     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
     269     */
     270    public static function getAllRawData()
     271    {
     272        return self::getInstalled();
     273    }
     274
     275    /**
     276     * Lets you reload the static array from another file
     277     *
     278     * This is only useful for complex integrations in which a project needs to use
     279     * this class but then also needs to execute another project's autoloader in process,
     280     * and wants to ensure both projects have access to their version of installed.php.
     281     *
     282     * A typical case would be PHPUnit, where it would need to make sure it reads all
     283     * the data it needs from this class, then call reload() with
     284     * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
     285     * the project in which it runs can then also use this class safely, without
     286     * interference between PHPUnit's dependencies and the project's dependencies.
     287     *
     288     * @param  array[] $data A vendor/composer/installed.php data set
     289     * @return void
     290     *
     291     * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>} $data
     292     */
     293    public static function reload($data)
     294    {
     295        self::$installed = $data;
     296        self::$installedByVendor = array();
     297    }
     298
     299    /**
     300     * @return array[]
     301     * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string}>}>
     302     */
     303    private static function getInstalled()
     304    {
     305        if (null === self::$canGetVendors) {
     306            self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
     307        }
     308
     309        $installed = array();
     310
     311        if (self::$canGetVendors) {
     312            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     313                if (isset(self::$installedByVendor[$vendorDir])) {
     314                    $installed[] = self::$installedByVendor[$vendorDir];
     315                } elseif (is_file($vendorDir.'/composer/installed.php')) {
     316                    $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     317                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     318                        self::$installed = $installed[count($installed) - 1];
     319                    }
     320                }
     321            }
     322        }
     323
     324        if (null === self::$installed) {
     325            // only require the installed.php file if this file is loaded from its dumped location,
     326            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
     327            if (substr(__DIR__, -8, 1) !== 'C') {
     328                self::$installed = require __DIR__ . '/installed.php';
     329            } else {
     330                self::$installed = array();
     331            }
     332        }
     333        $installed[] = self::$installed;
     334
     335        return $installed;
     336    }
    213337}
    214 
    215 
    216 
    217 
    218 
    219 
    220 
    221 
    222 
    223 public static function isInstalled($packageName)
    224 {
    225 return isset(self::$installed['versions'][$packageName]);
    226 }
    227 
    228 
    229 
    230 
    231 
    232 
    233 
    234 
    235 
    236 
    237 
    238 
    239 
    240 
    241 public static function satisfies(VersionParser $parser, $packageName, $constraint)
    242 {
    243 $constraint = $parser->parseConstraints($constraint);
    244 $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    245 
    246 return $provided->matches($constraint);
    247 }
    248 
    249 
    250 
    251 
    252 
    253 
    254 
    255 
    256 
    257 
    258 public static function getVersionRanges($packageName)
    259 {
    260 if (!isset(self::$installed['versions'][$packageName])) {
    261 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    262 }
    263 
    264 $ranges = array();
    265 if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
    266 $ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
    267 }
    268 if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
    269 $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
    270 }
    271 if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
    272 $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
    273 }
    274 if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
    275 $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
    276 }
    277 
    278 return implode(' || ', $ranges);
    279 }
    280 
    281 
    282 
    283 
    284 
    285 public static function getVersion($packageName)
    286 {
    287 if (!isset(self::$installed['versions'][$packageName])) {
    288 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    289 }
    290 
    291 if (!isset(self::$installed['versions'][$packageName]['version'])) {
    292 return null;
    293 }
    294 
    295 return self::$installed['versions'][$packageName]['version'];
    296 }
    297 
    298 
    299 
    300 
    301 
    302 public static function getPrettyVersion($packageName)
    303 {
    304 if (!isset(self::$installed['versions'][$packageName])) {
    305 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    306 }
    307 
    308 if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
    309 return null;
    310 }
    311 
    312 return self::$installed['versions'][$packageName]['pretty_version'];
    313 }
    314 
    315 
    316 
    317 
    318 
    319 public static function getReference($packageName)
    320 {
    321 if (!isset(self::$installed['versions'][$packageName])) {
    322 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
    323 }
    324 
    325 if (!isset(self::$installed['versions'][$packageName]['reference'])) {
    326 return null;
    327 }
    328 
    329 return self::$installed['versions'][$packageName]['reference'];
    330 }
    331 
    332 
    333 
    334 
    335 
    336 public static function getRootPackage()
    337 {
    338 return self::$installed['root'];
    339 }
    340 
    341 
    342 
    343 
    344 
    345 
    346 
    347 public static function getRawData()
    348 {
    349 return self::$installed;
    350 }
    351 
    352 
    353 
    354 
    355 
    356 
    357 
    358 
    359 
    360 
    361 
    362 
    363 
    364 
    365 
    366 
    367 
    368 
    369 
    370 public static function reload($data)
    371 {
    372 self::$installed = $data;
    373 }
    374 }
  • 2fas/trunk/vendor/composer/autoload_real.php

    r2470780 r2594222  
    2424
    2525        spl_autoload_register(array('ComposerAutoloaderInit66cf7295c106ae5a08d97a7953e2c171', 'loadClassLoader'), true, true);
    26         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
     26        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    2727        spl_autoload_unregister(array('ComposerAutoloaderInit66cf7295c106ae5a08d97a7953e2c171', 'loadClassLoader'));
    2828
  • 2fas/trunk/vendor/composer/installed.json

    r2551311 r2594222  
    557557        {
    558558            "name": "twofas/account-sdk",
    559             "version": "v4.2.0",
    560             "version_normalized": "4.2.0.0",
     559            "version": "v4.3.0",
     560            "version_normalized": "4.3.0.0",
    561561            "source": {
    562562                "type": "git",
    563563                "url": "https://github.com/twofas/account-sdk.git",
    564                 "reference": "ee9f2d361a747416e28c47fc6a44a1d3abe402f2"
    565             },
    566             "dist": {
    567                 "type": "zip",
    568                 "url": "https://api.github.com/repos/twofas/account-sdk/zipball/ee9f2d361a747416e28c47fc6a44a1d3abe402f2",
    569                 "reference": "ee9f2d361a747416e28c47fc6a44a1d3abe402f2",
     564                "reference": "59c4d8ec63a2882e1ed982aa5bbc36d360dd639c"
     565            },
     566            "dist": {
     567                "type": "zip",
     568                "url": "https://api.github.com/repos/twofas/account-sdk/zipball/59c4d8ec63a2882e1ed982aa5bbc36d360dd639c",
     569                "reference": "59c4d8ec63a2882e1ed982aa5bbc36d360dd639c",
    570570                "shasum": ""
    571571            },
     
    581581                "squizlabs/php_codesniffer": "^2.2"
    582582            },
    583             "time": "2020-04-09T10:38:54+00:00",
     583            "time": "2021-09-03T08:21:35+00:00",
    584584            "type": "library",
    585585            "installation-source": "dist",
     
    608608            ],
    609609            "description": "SDK for 2fas.com Account API",
     610            "support": {
     611                "issues": "https://github.com/twofas/account-sdk/issues",
     612                "source": "https://github.com/twofas/account-sdk/tree/v4.3.0"
     613            },
    610614            "install-path": "../twofas/account-sdk"
    611615        },
  • 2fas/trunk/vendor/composer/installed.php

    r2551311 r2594222  
    1 <?php return array (
    2   'root' =>
    3   array (
    4     'pretty_version' => 'dev-master',
    5     'version' => 'dev-master',
    6     'aliases' =>
    7     array (
     1<?php return array(
     2    'root' => array(
     3        'pretty_version' => 'dev-master',
     4        'version' => 'dev-master',
     5        'type' => 'wordpress-plugin',
     6        'install_path' => __DIR__ . '/../../',
     7        'aliases' => array(),
     8        'reference' => '16ab34c38e56f41eb9fa650f0b439d5a0ebdee7b',
     9        'name' => 'twofas/twofas-wp-plugin',
     10        'dev' => false,
    811    ),
    9     'reference' => 'a1045640303c37ec14e37b68208849426b53b14c',
    10     'name' => 'twofas/twofas-wp-plugin',
    11   ),
    12   'versions' =>
    13   array (
    14     'container-interop/container-interop' =>
    15     array (
    16       'pretty_version' => '1.2.0',
    17       'version' => '1.2.0.0',
    18       'aliases' =>
    19       array (
    20       ),
    21       'reference' => '79cbf1341c22ec75643d841642dd5d6acd83bdb8',
     12    'versions' => array(
     13        'container-interop/container-interop' => array(
     14            'pretty_version' => '1.2.0',
     15            'version' => '1.2.0.0',
     16            'type' => 'library',
     17            'install_path' => __DIR__ . '/../container-interop/container-interop',
     18            'aliases' => array(),
     19            'reference' => '79cbf1341c22ec75643d841642dd5d6acd83bdb8',
     20            'dev_requirement' => false,
     21        ),
     22        'container-interop/container-interop-implementation' => array(
     23            'dev_requirement' => false,
     24            'provided' => array(
     25                0 => '^1.0',
     26            ),
     27        ),
     28        'endroid/qr-code' => array(
     29            'pretty_version' => '1.6.6',
     30            'version' => '1.6.6.0',
     31            'type' => 'library',
     32            'install_path' => __DIR__ . '/../endroid/qr-code',
     33            'aliases' => array(),
     34            'reference' => 'cef5d5b7b904d7bb0708eb744c35316364b65fa0',
     35            'dev_requirement' => false,
     36        ),
     37        'mnapoli/php-di' => array(
     38            'dev_requirement' => false,
     39            'replaced' => array(
     40                0 => '*',
     41            ),
     42        ),
     43        'php-di/invoker' => array(
     44            'pretty_version' => '1.3.3',
     45            'version' => '1.3.3.0',
     46            'type' => 'library',
     47            'install_path' => __DIR__ . '/../php-di/invoker',
     48            'aliases' => array(),
     49            'reference' => '1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7',
     50            'dev_requirement' => false,
     51        ),
     52        'php-di/php-di' => array(
     53            'pretty_version' => '5.4.6',
     54            'version' => '5.4.6.0',
     55            'type' => 'library',
     56            'install_path' => __DIR__ . '/../php-di/php-di',
     57            'aliases' => array(),
     58            'reference' => '3f9255659595f3e289f473778bb6c51aa72abbbd',
     59            'dev_requirement' => false,
     60        ),
     61        'php-di/phpdoc-reader' => array(
     62            'pretty_version' => '2.1.1',
     63            'version' => '2.1.1.0',
     64            'type' => 'library',
     65            'install_path' => __DIR__ . '/../php-di/phpdoc-reader',
     66            'aliases' => array(),
     67            'reference' => '15678f7451c020226807f520efb867ad26fbbfcf',
     68            'dev_requirement' => false,
     69        ),
     70        'psr/cache' => array(
     71            'pretty_version' => '1.0.1',
     72            'version' => '1.0.1.0',
     73            'type' => 'library',
     74            'install_path' => __DIR__ . '/../psr/cache',
     75            'aliases' => array(),
     76            'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
     77            'dev_requirement' => false,
     78        ),
     79        'psr/container' => array(
     80            'pretty_version' => '1.0.0',
     81            'version' => '1.0.0.0',
     82            'type' => 'library',
     83            'install_path' => __DIR__ . '/../psr/container',
     84            'aliases' => array(),
     85            'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
     86            'dev_requirement' => false,
     87        ),
     88        'psr/container-implementation' => array(
     89            'dev_requirement' => false,
     90            'provided' => array(
     91                0 => '^1.0',
     92            ),
     93        ),
     94        'sentry/sentry' => array(
     95            'pretty_version' => '1.11.0',
     96            'version' => '1.11.0.0',
     97            'type' => 'library',
     98            'install_path' => __DIR__ . '/../sentry/sentry',
     99            'aliases' => array(),
     100            'reference' => '159eeaa02bb2ef8a8ec669f3c88e4bff7e6a7ffe',
     101            'dev_requirement' => false,
     102        ),
     103        'symfony/polyfill-ctype' => array(
     104            'pretty_version' => 'v1.19.0',
     105            'version' => '1.19.0.0',
     106            'type' => 'library',
     107            'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
     108            'aliases' => array(),
     109            'reference' => 'aed596913b70fae57be53d86faa2e9ef85a2297b',
     110            'dev_requirement' => false,
     111        ),
     112        'twig/twig' => array(
     113            'pretty_version' => 'v1.42.5',
     114            'version' => '1.42.5.0',
     115            'type' => 'library',
     116            'install_path' => __DIR__ . '/../twig/twig',
     117            'aliases' => array(),
     118            'reference' => '87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e',
     119            'dev_requirement' => false,
     120        ),
     121        'twofas/account-sdk' => array(
     122            'pretty_version' => 'v4.3.0',
     123            'version' => '4.3.0.0',
     124            'type' => 'library',
     125            'install_path' => __DIR__ . '/../twofas/account-sdk',
     126            'aliases' => array(),
     127            'reference' => '59c4d8ec63a2882e1ed982aa5bbc36d360dd639c',
     128            'dev_requirement' => false,
     129        ),
     130        'twofas/encryption' => array(
     131            'pretty_version' => 'v4.0.0',
     132            'version' => '4.0.0.0',
     133            'type' => 'library',
     134            'install_path' => __DIR__ . '/../twofas/encryption',
     135            'aliases' => array(),
     136            'reference' => '7be586110b276bd1059093ff5aa0fb6bf6f14913',
     137            'dev_requirement' => false,
     138        ),
     139        'twofas/sdk' => array(
     140            'pretty_version' => 'v7.2.0',
     141            'version' => '7.2.0.0',
     142            'type' => 'library',
     143            'install_path' => __DIR__ . '/../twofas/sdk',
     144            'aliases' => array(),
     145            'reference' => 'd6a689aa8479e4f2d6a6a923e6e4c84fae25d829',
     146            'dev_requirement' => false,
     147        ),
     148        'twofas/twofas-wp-plugin' => array(
     149            'pretty_version' => 'dev-master',
     150            'version' => 'dev-master',
     151            'type' => 'wordpress-plugin',
     152            'install_path' => __DIR__ . '/../../',
     153            'aliases' => array(),
     154            'reference' => '16ab34c38e56f41eb9fa650f0b439d5a0ebdee7b',
     155            'dev_requirement' => false,
     156        ),
     157        'twofas/validation-rules' => array(
     158            'pretty_version' => 'v1.0.1',
     159            'version' => '1.0.1.0',
     160            'type' => 'library',
     161            'install_path' => __DIR__ . '/../twofas/validation-rules',
     162            'aliases' => array(),
     163            'reference' => '7a5c7126843d218623a8cffebfa4a22bd8ce157c',
     164            'dev_requirement' => false,
     165        ),
     166        'twofas/wp-plugin-core' => array(
     167            'pretty_version' => 'v3.0.1',
     168            'version' => '3.0.1.0',
     169            'type' => 'library',
     170            'install_path' => __DIR__ . '/../twofas/wp-plugin-core',
     171            'aliases' => array(),
     172            'reference' => '9f125afdb62ca7442bc22deff602b212b7b2dd4d',
     173            'dev_requirement' => false,
     174        ),
     175        'whichbrowser/parser' => array(
     176            'pretty_version' => 'v2.1.2',
     177            'version' => '2.1.2.0',
     178            'type' => 'library',
     179            'install_path' => __DIR__ . '/../whichbrowser/parser',
     180            'aliases' => array(),
     181            'reference' => 'bcf642a1891032de16a5ab976fd352753dd7f9a0',
     182            'dev_requirement' => false,
     183        ),
    22184    ),
    23     'container-interop/container-interop-implementation' =>
    24     array (
    25       'provided' =>
    26       array (
    27         0 => '^1.0',
    28       ),
    29     ),
    30     'endroid/qr-code' =>
    31     array (
    32       'pretty_version' => '1.6.6',
    33       'version' => '1.6.6.0',
    34       'aliases' =>
    35       array (
    36       ),
    37       'reference' => 'cef5d5b7b904d7bb0708eb744c35316364b65fa0',
    38     ),
    39     'mnapoli/php-di' =>
    40     array (
    41       'replaced' =>
    42       array (
    43         0 => '*',
    44       ),
    45     ),
    46     'php-di/invoker' =>
    47     array (
    48       'pretty_version' => '1.3.3',
    49       'version' => '1.3.3.0',
    50       'aliases' =>
    51       array (
    52       ),
    53       'reference' => '1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7',
    54     ),
    55     'php-di/php-di' =>
    56     array (
    57       'pretty_version' => '5.4.6',
    58       'version' => '5.4.6.0',
    59       'aliases' =>
    60       array (
    61       ),
    62       'reference' => '3f9255659595f3e289f473778bb6c51aa72abbbd',
    63     ),
    64     'php-di/phpdoc-reader' =>
    65     array (
    66       'pretty_version' => '2.1.1',
    67       'version' => '2.1.1.0',
    68       'aliases' =>
    69       array (
    70       ),
    71       'reference' => '15678f7451c020226807f520efb867ad26fbbfcf',
    72     ),
    73     'psr/cache' =>
    74     array (
    75       'pretty_version' => '1.0.1',
    76       'version' => '1.0.1.0',
    77       'aliases' =>
    78       array (
    79       ),
    80       'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
    81     ),
    82     'psr/container' =>
    83     array (
    84       'pretty_version' => '1.0.0',
    85       'version' => '1.0.0.0',
    86       'aliases' =>
    87       array (
    88       ),
    89       'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',
    90     ),
    91     'psr/container-implementation' =>
    92     array (
    93       'provided' =>
    94       array (
    95         0 => '^1.0',
    96       ),
    97     ),
    98     'sentry/sentry' =>
    99     array (
    100       'pretty_version' => '1.11.0',
    101       'version' => '1.11.0.0',
    102       'aliases' =>
    103       array (
    104       ),
    105       'reference' => '159eeaa02bb2ef8a8ec669f3c88e4bff7e6a7ffe',
    106     ),
    107     'symfony/polyfill-ctype' =>
    108     array (
    109       'pretty_version' => 'v1.19.0',
    110       'version' => '1.19.0.0',
    111       'aliases' =>
    112       array (
    113       ),
    114       'reference' => 'aed596913b70fae57be53d86faa2e9ef85a2297b',
    115     ),
    116     'twig/twig' =>
    117     array (
    118       'pretty_version' => 'v1.42.5',
    119       'version' => '1.42.5.0',
    120       'aliases' =>
    121       array (
    122       ),
    123       'reference' => '87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e',
    124     ),
    125     'twofas/account-sdk' =>
    126     array (
    127       'pretty_version' => 'v4.2.0',
    128       'version' => '4.2.0.0',
    129       'aliases' =>
    130       array (
    131       ),
    132       'reference' => 'ee9f2d361a747416e28c47fc6a44a1d3abe402f2',
    133     ),
    134     'twofas/encryption' =>
    135     array (
    136       'pretty_version' => 'v4.0.0',
    137       'version' => '4.0.0.0',
    138       'aliases' =>
    139       array (
    140       ),
    141       'reference' => '7be586110b276bd1059093ff5aa0fb6bf6f14913',
    142     ),
    143     'twofas/sdk' =>
    144     array (
    145       'pretty_version' => 'v7.2.0',
    146       'version' => '7.2.0.0',
    147       'aliases' =>
    148       array (
    149       ),
    150       'reference' => 'd6a689aa8479e4f2d6a6a923e6e4c84fae25d829',
    151     ),
    152     'twofas/twofas-wp-plugin' =>
    153     array (
    154       'pretty_version' => 'dev-master',
    155       'version' => 'dev-master',
    156       'aliases' =>
    157       array (
    158       ),
    159       'reference' => 'a1045640303c37ec14e37b68208849426b53b14c',
    160     ),
    161     'twofas/validation-rules' =>
    162     array (
    163       'pretty_version' => 'v1.0.1',
    164       'version' => '1.0.1.0',
    165       'aliases' =>
    166       array (
    167       ),
    168       'reference' => '7a5c7126843d218623a8cffebfa4a22bd8ce157c',
    169     ),
    170     'twofas/wp-plugin-core' =>
    171     array (
    172       'pretty_version' => 'v3.0.1',
    173       'version' => '3.0.1.0',
    174       'aliases' =>
    175       array (
    176       ),
    177       'reference' => '9f125afdb62ca7442bc22deff602b212b7b2dd4d',
    178     ),
    179     'whichbrowser/parser' =>
    180     array (
    181       'pretty_version' => 'v2.1.2',
    182       'version' => '2.1.2.0',
    183       'aliases' =>
    184       array (
    185       ),
    186       'reference' => 'bcf642a1891032de16a5ab976fd352753dd7f9a0',
    187     ),
    188   ),
    189185);
  • 2fas/trunk/vendor/twofas/account-sdk/src/Sdk.php

    r2343404 r2594222  
    2727     * @var string
    2828     */
    29     const VERSION = '4.2.0';
     29    const VERSION = '4.3.0';
    3030
    3131    /**
     
    231231        if ($response->matchesHttpCode(HttpCodes::OK)) {
    232232            return $integration;
    233         }
    234 
    235         throw $response->getError();
    236     }
    237 
    238     /**
    239      * Used for changing integrations encryption keys
    240      *
    241      * @param Integration $integration
    242      *
    243      * @return Integration
    244      *
    245      * @throws Exception
    246      * @throws ValidationException
    247      */
    248     public function resetIntegrationEncryptionKeys(Integration $integration)
    249     {
    250         $response = $this->call(
    251             $this->specificIntegrationTokenType,
    252             'PUT',
    253             $this->createEndpoint('v2/integrations/' . $integration->getId() . '/reset-encryption-keys'),
    254             $integration->toArray()
    255         );
    256 
    257         if ($response->matchesHttpCode(HttpCodes::OK)) {
    258             return $this->hydrator->getIntegrationFromResponseData($response->getData());
    259233        }
    260234
Note: See TracChangeset for help on using the changeset viewer.