├── .gitignore ├── vendor ├── pragmarx │ └── google2fa │ │ ├── tests │ │ ├── .gitkeep │ │ └── bootstrap.php │ │ ├── upgrading.md │ │ ├── .gitignore │ │ ├── docs │ │ └── playground.jpg │ │ ├── src │ │ ├── Exceptions │ │ │ ├── InvalidCharactersException.php │ │ │ ├── SecretKeyTooShortException.php │ │ │ ├── IncompatibleWithGoogleAuthenticatorException.php │ │ │ └── InsecureCallException.php │ │ └── Support │ │ │ ├── Url.php │ │ │ ├── Constants.php │ │ │ ├── QRCode.php │ │ │ └── Base32.php │ │ ├── .travis.yml │ │ ├── LICENSE.md │ │ ├── .scrutinizer.yml │ │ ├── RELICENSED.md │ │ ├── phpunit.xml │ │ ├── composer.json │ │ └── changelog.md ├── paragonie │ ├── constant_time_encoding │ │ ├── .gitignore │ │ ├── psalm.xml │ │ ├── .travis.yml │ │ ├── phpunit.xml.dist │ │ ├── tests │ │ │ ├── Base64DotSlashTest.php │ │ │ ├── Base64DotSlashOrderedTest.php │ │ │ ├── HexTest.php │ │ │ ├── Base32Test.php │ │ │ ├── Base32HexTest.php │ │ │ └── Base64UrlSafeTest.php │ │ ├── composer.json │ │ ├── src │ │ │ ├── EncoderInterface.php │ │ │ ├── Binary.php │ │ │ ├── Base64DotSlashOrdered.php │ │ │ ├── Base64DotSlash.php │ │ │ └── Base64UrlSafe.php │ │ ├── LICENSE.txt │ │ └── README.md │ └── random_compat │ │ ├── build-phar.sh │ │ ├── dist │ │ ├── random_compat.phar.pubkey │ │ └── random_compat.phar.pubkey.asc │ │ ├── psalm-autoload.php │ │ ├── composer.json │ │ ├── LICENSE │ │ ├── psalm.xml │ │ ├── other │ │ └── build_phar.php │ │ └── lib │ │ ├── error_polyfill.php │ │ ├── random_bytes_mcrypt.php │ │ ├── cast_to_int.php │ │ ├── random_bytes_libsodium_legacy.php │ │ ├── random_bytes_libsodium.php │ │ └── random_bytes_com_dotnet.php ├── dasprid │ └── enum │ │ ├── .gitignore │ │ ├── .coveralls.yml │ │ ├── src │ │ ├── Exception │ │ │ ├── ExceptionInterface.php │ │ │ ├── MismatchException.php │ │ │ ├── ExpectationException.php │ │ │ ├── IllegalArgumentException.php │ │ │ ├── CloneNotSupportedException.php │ │ │ ├── SerializeNotSupportedException.php │ │ │ └── UnserializeNotSupportedException.php │ │ └── NullValue.php │ │ ├── phpunit.xml.dist │ │ ├── test │ │ ├── WeekDay.php │ │ ├── NullValueTest.php │ │ └── Planet.php │ │ ├── composer.json │ │ ├── phpcs.xml │ │ └── .travis.yml ├── autoload.php ├── composer │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_files.php │ ├── autoload_psr4.php │ ├── LICENSE │ ├── autoload_real.php │ └── autoload_static.php ├── bacon │ └── bacon-qr-code │ │ ├── src │ │ ├── Exception │ │ │ ├── WriterException.php │ │ │ ├── ExceptionInterface.php │ │ │ ├── RuntimeException.php │ │ │ ├── OutOfBoundsException.php │ │ │ ├── InvalidArgumentException.php │ │ │ └── UnexpectedValueException.php │ │ ├── Renderer │ │ │ ├── RendererInterface.php │ │ │ ├── Path │ │ │ │ ├── OperationInterface.php │ │ │ │ ├── Close.php │ │ │ │ ├── Line.php │ │ │ │ ├── Move.php │ │ │ │ ├── Curve.php │ │ │ │ └── Path.php │ │ │ ├── Color │ │ │ │ ├── ColorInterface.php │ │ │ │ ├── Gray.php │ │ │ │ ├── Alpha.php │ │ │ │ ├── Rgb.php │ │ │ │ └── Cmyk.php │ │ │ ├── Module │ │ │ │ ├── ModuleInterface.php │ │ │ │ ├── SquareModule.php │ │ │ │ ├── DotsModule.php │ │ │ │ └── EdgeIterator │ │ │ │ │ └── Edge.php │ │ │ ├── RendererStyle │ │ │ │ ├── GradientType.php │ │ │ │ ├── Gradient.php │ │ │ │ ├── EyeFill.php │ │ │ │ └── RendererStyle.php │ │ │ ├── Eye │ │ │ │ ├── EyeInterface.php │ │ │ │ ├── CompositeEye.php │ │ │ │ ├── SquareEye.php │ │ │ │ ├── ModuleEye.php │ │ │ │ └── SimpleCircleEye.php │ │ │ ├── Image │ │ │ │ ├── TransformationMatrix.php │ │ │ │ └── ImageBackEndInterface.php │ │ │ └── PlainTextRenderer.php │ │ ├── Common │ │ │ ├── BitUtils.php │ │ │ ├── EcBlock.php │ │ │ ├── ErrorCorrectionLevel.php │ │ │ ├── EcBlocks.php │ │ │ └── Mode.php │ │ ├── Encoder │ │ │ ├── BlockPair.php │ │ │ └── QrCode.php │ │ └── Writer.php │ │ ├── CHANGELOG.md │ │ ├── composer.json │ │ ├── LICENSE │ │ └── README.md └── symfony │ ├── polyfill-util │ ├── README.md │ ├── Binary.php │ ├── composer.json │ ├── LICENSE │ ├── BinaryNoFuncOverload.php │ ├── BinaryOnFuncOverload.php │ ├── LegacyTestListener.php │ └── TestListener.php │ └── polyfill-php56 │ ├── README.md │ ├── composer.json │ ├── LICENSE │ └── bootstrap.php ├── authenticator ├── fields │ ├── qrcode │ │ ├── assets │ │ │ └── css │ │ │ │ └── qrcode.css │ │ └── qrcode.php │ └── authenticator │ │ ├── assets │ │ └── css │ │ │ └── authenticator.css │ │ └── authenticator.php ├── blueprints │ └── users │ │ └── default.yml ├── views │ ├── settings │ │ └── index.php │ └── auth │ │ └── login.php ├── forms │ ├── settings │ │ ├── backup.php │ │ ├── turn-off.php │ │ └── turn-on.php │ └── auth │ │ └── login.php └── translations │ ├── en.json │ ├── nl_BE.json │ └── pt_BR.json ├── package.json ├── .editorconfig ├── composer.json ├── authenticator.php └── src ├── Exceptions ├── InvalidBackupCode.php └── InvalidOrExpiredCode.php ├── View.php ├── Roots.php ├── Authenticator.php ├── bootstrap.php └── Controllers └── LoginController.php /.gitignore: -------------------------------------------------------------------------------- 1 | .php_cs.cache 2 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/tests/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/upgrading.md: -------------------------------------------------------------------------------- 1 | # Google2FA 2 | 3 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | vendor/ -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | vendor 3 | coverage 4 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/.gitignore: -------------------------------------------------------------------------------- 1 | /composer.lock 2 | /phpunit.xml 3 | /vendor/ 4 | -------------------------------------------------------------------------------- /authenticator/fields/qrcode/assets/css/qrcode.css: -------------------------------------------------------------------------------- 1 | .qrcode { 2 | text-align: center; 3 | } 4 | -------------------------------------------------------------------------------- /authenticator/blueprints/users/default.yml: -------------------------------------------------------------------------------- 1 | fields: 2 | authenticator: 3 | type: authenticator 4 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/.coveralls.yml: -------------------------------------------------------------------------------- 1 | coverage_clover: clover.xml 2 | json_path: coveralls-upload.json 3 | -------------------------------------------------------------------------------- /authenticator/views/settings/index.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/docs/playground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pedroborges/kirby-authenticator/HEAD/vendor/pragmarx/google2fa/docs/playground.jpg -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/build-phar.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) 4 | 5 | php -dphar.readonly=0 "$basedir/other/build_phar.php" $* -------------------------------------------------------------------------------- /vendor/autoload.php: -------------------------------------------------------------------------------- 1 | ", 4 | "version": "1.0.0-beta", 5 | "description": "Kirby Authenticator", 6 | "type": "kirby-plugin", 7 | "license": "MIT" 8 | } 9 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Exception/WriterException.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/dist/random_compat.phar.pubkey: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm 3 | pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p 4 | +h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc 5 | -----END PUBLIC KEY----- 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.yml] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/RendererInterface.php: -------------------------------------------------------------------------------- 1 | setAllowInsecureCallToGoogleApis(true).'; 10 | } 11 | -------------------------------------------------------------------------------- /authenticator.php: -------------------------------------------------------------------------------- 1 | 8 | * @copyright Pedro Borges 9 | * @link https://github.com/pedroborges/kirby-authenticator 10 | * @license MIT 11 | */ 12 | 13 | if (! function_exists('panel')) { 14 | return; 15 | } 16 | 17 | require_once(__DIR__ . DS . 'vendor' . DS . 'autoload.php'); 18 | -------------------------------------------------------------------------------- /authenticator/fields/authenticator/assets/css/authenticator.css: -------------------------------------------------------------------------------- 1 | input[name="number"] { 2 | -moz-appearance: textfield; 3 | } 4 | 5 | input[type="number"]::-webkit-outer-spin-button, 6 | input[type="number"]::-webkit-inner-spin-button { 7 | -webkit-appearance: none; 8 | margin: 0; 9 | } 10 | 11 | .two-steps--on .label span { 12 | color: #8dae28; 13 | } 14 | 15 | .two-steps--off .label span { 16 | color: #b3000a; 17 | } 18 | -------------------------------------------------------------------------------- /authenticator/views/auth/login.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/src/Support/Url.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/paragonie/random_compat/lib/random.php', 10 | 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', 11 | '4ae513dcd6c6781fd946d90523cfc740' => $baseDir . '/src/bootstrap.php', 12 | ); 13 | -------------------------------------------------------------------------------- /src/Exceptions/InvalidOrExpiredCode.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Polyfill\Util; 13 | 14 | if (extension_loaded('mbstring')) { 15 | class Binary extends BinaryOnFuncOverload {} 16 | } else { 17 | class Binary extends BinaryNoFuncOverload {} 18 | } 19 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/src/Support/Constants.php: -------------------------------------------------------------------------------- 1 | roots()->views() . DS . $file . '.php'; 13 | 14 | // Default to panel views 15 | $this->_root = file_exists($pluginView) 16 | ? Authenticator::instance()->roots()->views() 17 | : Panel::instance()->roots()->views(); 18 | $this->_file = $file; 19 | $this->_data = $data; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Module/ModuleInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | ./test 9 | 10 | 11 | 12 | 13 | 14 | src 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Path/Close.php: -------------------------------------------------------------------------------- 1 | root = $root ? $root : dirname(__DIR__); 14 | 15 | $this->index = $this->root . DS . 'authenticator'; 16 | 17 | $this->blueprints = $this->index . DS . 'blueprints'; 18 | $this->fields = $this->index . DS . 'fields'; 19 | $this->forms = $this->index . DS . 'forms'; 20 | $this->translations = $this->index . DS . 'translations'; 21 | $this->views = $this->index . DS . 'views'; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Eye/EyeInterface.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/symfony/polyfill-util'), 10 | 'Symfony\\Polyfill\\Php56\\' => array($vendorDir . '/symfony/polyfill-php56'), 11 | 'PragmaRX\\Google2FA\\Tests\\' => array($vendorDir . '/pragmarx/google2fa/tests'), 12 | 'PragmaRX\\Google2FA\\' => array($vendorDir . '/pragmarx/google2fa/src'), 13 | 'PedroBorges\\Authenticator\\' => array($baseDir . '/src'), 14 | 'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), 15 | 'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'), 16 | 'BaconQrCode\\' => array($vendorDir . '/bacon/bacon-qr-code/src'), 17 | ); 18 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: php 3 | 4 | php: 5 | - 5.4 6 | - 5.5 7 | - 5.6 8 | - 7.0 9 | - 7.1 10 | - 7.2 11 | - nightly 12 | 13 | # This triggers builds to run on the new TravisCI infrastructure. 14 | # See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/ 15 | sudo: false 16 | 17 | ## Cache composer 18 | cache: 19 | directories: 20 | - $HOME/.composer/cache 21 | 22 | before_script: 23 | - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist 24 | 25 | script: 26 | - vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover 27 | 28 | after_script: 29 | - | 30 | if [[ "$TRAVIS_PHP_VERSION" == '7.2' ]]; then 31 | wget https://scrutinizer-ci.com/ocular.phar 32 | php ocular.phar code-coverage:upload --format=php-clover coverage.clover 33 | fi 34 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Path/Line.php: -------------------------------------------------------------------------------- 1 | x = $x; 21 | $this->y = $y; 22 | } 23 | 24 | public function getX() : float 25 | { 26 | return $this->x; 27 | } 28 | 29 | public function getY() : float 30 | { 31 | return $this->y; 32 | } 33 | 34 | /** 35 | * @return self 36 | */ 37 | public function translate(float $x, float $y) : OperationInterface 38 | { 39 | return new self($this->x + $x, $this->y + $y); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Path/Move.php: -------------------------------------------------------------------------------- 1 | x = $x; 21 | $this->y = $y; 22 | } 23 | 24 | public function getX() : float 25 | { 26 | return $this->x; 27 | } 28 | 29 | public function getY() : float 30 | { 31 | return $this->y; 32 | } 33 | 34 | /** 35 | * @return self 36 | */ 37 | public function translate(float $x, float $y) : OperationInterface 38 | { 39 | return new self($this->x + $x, $this->x + $y); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-util/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/polyfill-util", 3 | "type": "library", 4 | "description": "Symfony utilities for portability of PHP codes", 5 | "keywords": ["polyfill", "shim", "compat", "compatibility"], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Nicolas Grekas", 11 | "email": "p@tchwork.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.3.3" 20 | }, 21 | "autoload": { 22 | "psr-4": { "Symfony\\Polyfill\\Util\\": "" } 23 | }, 24 | "minimum-stability": "dev", 25 | "extra": { 26 | "branch-alias": { 27 | "dev-master": "1.8-dev" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file, in reverse chronological order by release. 4 | 5 | ## 2.0.0 - 2018-04-25 6 | 7 | ### Added 8 | 9 | - [#25](https://github.com/Bacon/BaconQrCode/pull/25) allows for setting a more compact text output 10 | 11 | - CHANGELOG.md added (how meta) 12 | 13 | - Allows more complex shapes for modules 14 | 15 | - Allows setting a gradient for the foreground 16 | 17 | - Allows transparent backgrounds and alpha channel on all colors 18 | 19 | ### Changed 20 | 21 | - Minimum PHP version changed to 7.1 22 | 23 | - Imagick renderer now allows setting different output formats 24 | 25 | - New optimized SVG renderer 26 | 27 | ### Deprecated 28 | 29 | - Nothing. 30 | 31 | ### Removed 32 | 33 | - Legacy ZF module support removed 34 | 35 | ### Fixed 36 | 37 | - Non-release files are excluded from composer packages 38 | -------------------------------------------------------------------------------- /authenticator/forms/settings/backup.php: -------------------------------------------------------------------------------- 1 | [ 6 | 'label' => 'authenticator.backup.label', 7 | 'type' => 'info', 8 | 'text' => 'authenticator.backup.text' 9 | ], 10 | 'backup' => [ 11 | 'type' => 'text', 12 | 'icon' => 'shield', 13 | 'readonly' => true 14 | ], 15 | 'note' => [ 16 | 'type' => 'info', 17 | 'text' => 'authenticator.backup.note' 18 | ], 19 | ], [ 20 | 'backup' => $backup 21 | ]); 22 | 23 | $form->cancel('users/' . $user->username . '/edit'); 24 | 25 | $form->buttons->submit->addClass('btn-positive'); 26 | $form->buttons->submit->value = l('save'); 27 | $form->buttons->cancel->html = l('authenticator.backup.cancel'); 28 | 29 | return $form; 30 | }; 31 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Eye/CompositeEye.php: -------------------------------------------------------------------------------- 1 | externalEye = $externalEye; 26 | $this->internalEye = $internalEye; 27 | } 28 | 29 | public function getExternalPath() : Path 30 | { 31 | return $this->externalEye->getExternalPath(); 32 | } 33 | 34 | public function getInternalPath() : Path 35 | { 36 | return $this->externalEye->getInternalPath(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bacon/bacon-qr-code", 3 | "description": "BaconQrCode is a QR code generator for PHP.", 4 | "license" : "BSD-2-Clause", 5 | "homepage": "https://github.com/Bacon/BaconQrCode", 6 | "require": { 7 | "php": "^7.1", 8 | "ext-iconv": "*", 9 | "dasprid/enum": "^1.0" 10 | }, 11 | "suggest": { 12 | "ext-imagick": "to generate QR code images" 13 | }, 14 | "authors": [ 15 | { 16 | "name": "Ben Scholzen 'DASPRiD'", 17 | "email": "mail@dasprids.de", 18 | "homepage": "http://www.dasprids.de", 19 | "role": "Developer" 20 | } 21 | ], 22 | "autoload": { 23 | "psr-4": { 24 | "BaconQrCode\\": "src/" 25 | } 26 | }, 27 | "require-dev": { 28 | "phpunit/phpunit": "^6.4", 29 | "squizlabs/php_codesniffer": "^3.1", 30 | "phly/keep-a-changelog": "^1.4" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-php56/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/polyfill-php56", 3 | "type": "library", 4 | "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", 5 | "keywords": ["polyfill", "shim", "compatibility", "portable"], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Nicolas Grekas", 11 | "email": "p@tchwork.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.3.3", 20 | "symfony/polyfill-util": "~1.0" 21 | }, 22 | "autoload": { 23 | "psr-4": { "Symfony\\Polyfill\\Php56\\": "" }, 24 | "files": [ "bootstrap.php" ] 25 | }, 26 | "minimum-stability": "dev", 27 | "extra": { 28 | "branch-alias": { 29 | "dev-master": "1.8-dev" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Enum coding standard 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | src 29 | test 30 | 31 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | tests 17 | 18 | 19 | 20 | 21 | ./tests 22 | 23 | 24 | 25 | 26 | ./src 27 | 28 | 29 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/test/NullValueTest.php: -------------------------------------------------------------------------------- 1 | expectException(CloneNotSupportedException::class); 17 | clone NullValue::instance(); 18 | } 19 | 20 | public function testExceptionOnSerializeAttempt() : void 21 | { 22 | $this->expectException(SerializeNotSupportedException::class); 23 | serialize(NullValue::instance()); 24 | } 25 | 26 | public function testExceptionOnUnserializeAttempt() : void 27 | { 28 | $this->expectException(UnserializeNotSupportedException::class); 29 | unserialize('O:22:"DASPRiD\\Enum\\NullValue":0:{}'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "paragonie/random_compat", 3 | "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", 4 | "keywords": [ 5 | "csprng", 6 | "random", 7 | "polyfill", 8 | "pseudorandom" 9 | ], 10 | "license": "MIT", 11 | "type": "library", 12 | "authors": [ 13 | { 14 | "name": "Paragon Initiative Enterprises", 15 | "email": "security@paragonie.com", 16 | "homepage": "https://paragonie.com" 17 | } 18 | ], 19 | "support": { 20 | "issues": "https://github.com/paragonie/random_compat/issues", 21 | "email": "info@paragonie.com", 22 | "source": "https://github.com/paragonie/random_compat" 23 | }, 24 | "require": { 25 | "php": ">=5.2.0" 26 | }, 27 | "require-dev": { 28 | "phpunit/phpunit": "4.*|5.*" 29 | }, 30 | "suggest": { 31 | "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." 32 | }, 33 | "autoload": { 34 | "files": [ 35 | "lib/random.php" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/Gradient.php: -------------------------------------------------------------------------------- 1 | startColor = $startColor; 28 | $this->endColor = $endColor; 29 | $this->type = $type; 30 | } 31 | 32 | public function getStartColor() : ColorInterface 33 | { 34 | return $this->startColor; 35 | } 36 | 37 | public function getEndColor() : ColorInterface 38 | { 39 | return $this->endColor; 40 | } 41 | 42 | public function getType() : GradientType 43 | { 44 | return $this->type; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/tests/Base64DotSlashTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 18 | $random, 19 | Base64DotSlash::decode($enc) 20 | ); 21 | 22 | $unpadded = \rtrim($enc, '='); 23 | $this->assertSame( 24 | $random, 25 | Base64DotSlash::decode($unpadded) 26 | ); 27 | $this->assertSame( 28 | $random, 29 | Base64DotSlash::decode($unpadded) 30 | ); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2014-2018 Phil, Antonio Carlos Ribeiro and All Contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Common/BitUtils.php: -------------------------------------------------------------------------------- 1 | >>" in other 22 | * languages. 23 | */ 24 | public static function unsignedRightShift(int $a, int $b) : int 25 | { 26 | return ( 27 | $a >= 0 28 | ? $a >> $b 29 | : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1)) 30 | ); 31 | } 32 | 33 | /** 34 | * Gets the number of trailing zeros. 35 | */ 36 | public static function numberOfTrailingZeros(int $i) : int 37 | { 38 | $lastPos = strrpos(str_pad(decbin($i), 32, '0', STR_PAD_LEFT), '1'); 39 | return $lastPos === false ? 32 : 31 - $lastPos; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /authenticator/forms/settings/turn-off.php: -------------------------------------------------------------------------------- 1 | [ 6 | 'label' => 'authenticator.turnOff.label', 7 | 'type' => 'info', 8 | 'text' => 'authenticator.turnOff.text' 9 | ], 10 | 'security_code' => [ 11 | 'label' => 'authenticator.securityCode.confirmation.label', 12 | 'type' => 'number', 13 | 'icon' => 'shield', 14 | 'placeholder' => null, 15 | 'min' => 1, 16 | 'max' => 999999, 17 | 'help' => 'authenticator.securityCode.help', 18 | 'required' => true, 19 | 'autofocus' => true 20 | ] 21 | ]); 22 | 23 | $form->attr('autocomplete', 'off'); 24 | $form->data('autosubmit', 'native'); 25 | 26 | $form->cancel('users/' . $user->username . '/edit'); 27 | 28 | $form->buttons->submit->addClass('btn-negative'); 29 | $form->buttons->submit->value = l('authenticator.toggle.off'); 30 | 31 | return $form; 32 | }; 33 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | checks: 2 | php: 3 | remove_extra_empty_lines: true 4 | remove_php_closing_tag: true 5 | remove_trailing_whitespace: true 6 | fix_use_statements: 7 | remove_unused: true 8 | preserve_multiple: false 9 | preserve_blanklines: true 10 | order_alphabetically: true 11 | fix_php_opening_tag: true 12 | fix_linefeed: true 13 | fix_line_ending: true 14 | fix_identation_4spaces: true 15 | fix_doc_comments: true 16 | 17 | filter: 18 | paths: [src/*] 19 | excluded_paths: [tests/*] 20 | 21 | coding_style: 22 | php: { } 23 | 24 | build: 25 | tests: 26 | override: 27 | - 28 | command: 'vendor/bin/phpunit -c phpunit.xml' 29 | coverage: 30 | file: 'coverage/coverage-clover.xml' 31 | format: 'clover' 32 | nodes: 33 | analysis: 34 | tests: 35 | override: 36 | - php-scrutinizer-run 37 | tests: true 38 | 39 | tools: 40 | external_code_coverage: true 41 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-php56/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2018 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-util/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2018 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/composer/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) Nils Adermann, Jordi Boggiano 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Color/Gray.php: -------------------------------------------------------------------------------- 1 | 100) { 21 | throw new Exception\InvalidArgumentException('Gray must be between 0 and 100'); 22 | } 23 | 24 | $this->gray = (int) $gray; 25 | } 26 | 27 | public function getGray() : int 28 | { 29 | return $this->gray; 30 | } 31 | 32 | public function toRgb() : Rgb 33 | { 34 | return new Rgb((int) ($this->gray * 2.55), (int) ($this->gray * 2.55), (int) ($this->gray * 2.55)); 35 | } 36 | 37 | public function toCmyk() : Cmyk 38 | { 39 | return new Cmyk(0, 0, 0, 100 - $this->gray); 40 | } 41 | 42 | public function toGray() : Gray 43 | { 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/tests/Base64DotSlashOrderedTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 18 | $random, 19 | Base64DotSlashOrdered::decode($enc) 20 | ); 21 | 22 | $unpadded = \rtrim($enc, '='); 23 | $this->assertSame( 24 | $random, 25 | Base64DotSlashOrdered::decode($unpadded) 26 | ); 27 | $this->assertSame( 28 | $random, 29 | Base64DotSlashOrdered::decode($unpadded) 30 | ); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/tests/HexTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 19 | $random, 20 | Hex::decode($enc) 21 | ); 22 | $this->assertSame( 23 | \bin2hex($random), 24 | $enc 25 | ); 26 | 27 | $enc = Hex::encodeUpper($random); 28 | $this->assertSame( 29 | $random, 30 | Hex::decode($enc) 31 | ); 32 | $this->assertSame( 33 | \strtoupper(\bin2hex($random)), 34 | $enc 35 | ); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Paragon Initiative Enterprises 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Common/EcBlock.php: -------------------------------------------------------------------------------- 1 | count = $count; 31 | $this->dataCodewords = $dataCodewords; 32 | } 33 | 34 | /** 35 | * Returns how many times the block is used. 36 | */ 37 | public function getCount() : int 38 | { 39 | return $this->count; 40 | } 41 | 42 | /** 43 | * Returns the number of data codewords. 44 | */ 45 | public function getDataCodewords() : int 46 | { 47 | return $this->dataCodewords; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: php 4 | 5 | cache: 6 | directories: 7 | - $HOME/.composer/cache 8 | - $HOME/.local 9 | - vendor 10 | 11 | matrix: 12 | fast_finish: true 13 | include: 14 | - php: 7.1 15 | env: 16 | - EXECUTE_CS_CHECK=true 17 | - EXECUTE_TEST_COVERALLS=true 18 | - PATH="$HOME/.local/bin:$PATH" 19 | - php: nightly 20 | allow_failures: 21 | - php: nightly 22 | 23 | before_install: 24 | - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi 25 | - composer self-update 26 | - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls:dev-master ; fi 27 | 28 | install: 29 | - travis_retry composer install --no-interaction 30 | - composer info -i 31 | 32 | script: 33 | - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi 34 | - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then vendor/bin/phpunit ; fi 35 | - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then vendor/bin/phpcs ; fi 36 | 37 | after_script: 38 | - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then vendor/bin/coveralls ; fi 39 | 40 | notifications: 41 | email: true 42 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | . 21 | * 22 | * PHP Google two-factor authentication module. 23 | * 24 | * See https://www.idontplaydarts.com/2011/07/google-totp-two-factor-authentication-for-php/ 25 | * for more details 26 | * 27 | * @author Phil 28 | **/ 29 | ``` 30 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Module/SquareModule.php: -------------------------------------------------------------------------------- 1 | getSimplifiedPoints(); 35 | $length = count($points); 36 | $path = $path->move($points[0][0], $points[0][1]); 37 | 38 | for ($i = 1; $i < $length; ++$i) { 39 | $path = $path->line($points[$i][0], $points[$i][1]); 40 | } 41 | 42 | $path = $path->close(); 43 | } 44 | 45 | return $path; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/psalm.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 18 | ./tests 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | ./src 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Eye/SquareEye.php: -------------------------------------------------------------------------------- 1 | move(-3.5, -3.5) 31 | ->line(3.5, -3.5) 32 | ->line(3.5, 3.5) 33 | ->line(-3.5, 3.5) 34 | ->close() 35 | ->move(-2.5, -2.5) 36 | ->line(-2.5, 2.5) 37 | ->line(2.5, 2.5) 38 | ->line(2.5, -2.5) 39 | ->close() 40 | ; 41 | } 42 | 43 | public function getInternalPath() : Path 44 | { 45 | return (new Path()) 46 | ->move(-1.5, -1.5) 47 | ->line(1.5, -1.5) 48 | ->line(1.5, 1.5) 49 | ->line(-1.5, 1.5) 50 | ->close() 51 | ; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pragmarx/google2fa", 3 | "description": "A One Time Password Authentication package, compatible with Google Authenticator.", 4 | "keywords": ["authentication", "two factor authentication", "google2fa", "laravel", "2fa"], 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Antonio Carlos Ribeiro", 9 | "email": "acr@antoniocarlosribeiro.com", 10 | "role": "Creator & Designer" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.4", 15 | "paragonie/constant_time_encoding": "~1.0|~2.0", 16 | "paragonie/random_compat": "~1.4|~2.0", 17 | "symfony/polyfill-php56": "~1.2" 18 | }, 19 | "require-dev": { 20 | "phpunit/phpunit": "~4|~5|~6", 21 | "bacon/bacon-qr-code": "~1.0" 22 | }, 23 | "autoload": { 24 | "psr-4": { 25 | "PragmaRX\\Google2FA\\": "src/", 26 | "PragmaRX\\Google2FA\\Tests\\": "tests/" 27 | } 28 | }, 29 | "extra": { 30 | "component": "package", 31 | "branch-alias": { 32 | "dev-master": "2.0-dev" 33 | } 34 | }, 35 | "suggest": { 36 | "bacon/bacon-qr-code": "Required to generate inline QR Codes." 37 | }, 38 | "minimum-stability": "dev", 39 | "prefer-stable": true 40 | } 41 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Color/Alpha.php: -------------------------------------------------------------------------------- 1 | 100) { 26 | throw new Exception\InvalidArgumentException('Alpha must be between 0 and 100'); 27 | } 28 | 29 | $this->alpha = $alpha; 30 | $this->baseColor = $baseColor; 31 | } 32 | 33 | public function getAlpha() : int 34 | { 35 | return $this->alpha; 36 | } 37 | 38 | public function getBaseColor() : ColorInterface 39 | { 40 | return $this->baseColor; 41 | } 42 | 43 | public function toRgb() : Rgb 44 | { 45 | return $this->baseColor->toRgb(); 46 | } 47 | 48 | public function toCmyk() : Cmyk 49 | { 50 | return $this->baseColor->toCmyk(); 51 | } 52 | 53 | public function toGray() : Gray 54 | { 55 | return $this->baseColor->toGray(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/src/NullValue.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | private $dataBytes; 19 | 20 | /** 21 | * Error correction bytes in the block. 22 | * 23 | * @var SplFixedArray 24 | */ 25 | private $errorCorrectionBytes; 26 | 27 | /** 28 | * Creates a new block pair. 29 | * 30 | * @param SplFixedArray $data 31 | * @param SplFixedArray $errorCorrection 32 | */ 33 | public function __construct(SplFixedArray $data, SplFixedArray $errorCorrection) 34 | { 35 | $this->dataBytes = $data; 36 | $this->errorCorrectionBytes = $errorCorrection; 37 | } 38 | 39 | /** 40 | * Gets the data bytes. 41 | * 42 | * @return SplFixedArray 43 | */ 44 | public function getDataBytes() : SplFixedArray 45 | { 46 | return $this->dataBytes; 47 | } 48 | 49 | /** 50 | * Gets the error correction bytes. 51 | * 52 | * @return SplFixedArray 53 | */ 54 | public function getErrorCorrectionBytes() : SplFixedArray 55 | { 56 | return $this->errorCorrectionBytes; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Eye/ModuleEye.php: -------------------------------------------------------------------------------- 1 | module = $module; 23 | } 24 | 25 | public function getExternalPath() : Path 26 | { 27 | $matrix = new ByteMatrix(7, 7); 28 | 29 | for ($x = 0; $x < 7; ++$x) { 30 | $matrix->set($x, 0, 1); 31 | $matrix->set($x, 6, 1); 32 | } 33 | 34 | for ($y = 1; $y < 6; ++$y) { 35 | $matrix->set(0, $y, 1); 36 | $matrix->set(6, $y, 1); 37 | } 38 | 39 | return $this->module->createPath($matrix)->translate(-3.5, -3.5); 40 | } 41 | 42 | public function getInternalPath() : Path 43 | { 44 | $matrix = new ByteMatrix(3, 3); 45 | 46 | for ($x = 0; $x < 3; ++$x) { 47 | for ($y = 0; $y < 3; ++$y) { 48 | $matrix->set($x, $y, 1); 49 | } 50 | } 51 | 52 | return $this->module->createPath($matrix)->translate(-1.5, -1.5); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Eye/SimpleCircleEye.php: -------------------------------------------------------------------------------- 1 | move(-3.5, -3.5) 31 | ->line(3.5, -3.5) 32 | ->line(3.5, 3.5) 33 | ->line(-3.5, 3.5) 34 | ->close() 35 | ->move(-2.5, -2.5) 36 | ->line(-2.5, 2.5) 37 | ->line(2.5, 2.5) 38 | ->line(2.5, -2.5) 39 | ->close() 40 | ; 41 | } 42 | 43 | public function getInternalPath() : Path 44 | { 45 | return (new Path()) 46 | ->move(1.5, 0) 47 | ->ellipticArc(1.5, 1.5, 0., false, true, 0., 1.5) 48 | ->ellipticArc(1.5, 1.5, 0., false, true, -1.5, 0.) 49 | ->ellipticArc(1.5, 1.5, 0., false, true, 0., -1.5) 50 | ->ellipticArc(1.5, 1.5, 0., false, true, 1.5, 0.) 51 | ->close() 52 | ; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Authenticator.php: -------------------------------------------------------------------------------- 1 | kirby = Kirby::instance(); 24 | $this->panel = Panel::instance(); 25 | $this->roots = new Roots($root); 26 | $this->site = $this->kirby->site(); 27 | 28 | $this->loadTranslation(); 29 | 30 | static::$instance = $this; 31 | } 32 | 33 | public static function instance($root = null) 34 | { 35 | return static::$instance = is_null(static::$instance) 36 | ? new static($root) 37 | : static::$instance; 38 | } 39 | 40 | public function roots() 41 | { 42 | return $this->roots; 43 | } 44 | 45 | protected function loadTranslation() 46 | { 47 | $lang = $this->kirby->option('panel.language', 'en'); 48 | $user = $this->site->user(); 49 | $root = $this->roots()->translations(); 50 | 51 | if ($user && $user->language()) { 52 | $lang = $user->language(); 53 | } 54 | 55 | $translation = $root . DS . $lang . '.json'; 56 | 57 | if (! is_file($translation)) { 58 | $translation = $root . DS . 'en.json'; 59 | } 60 | 61 | L::set(Data::read($translation)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Common/ErrorCorrectionLevel.php: -------------------------------------------------------------------------------- 1 | bits = $bits; 32 | } 33 | 34 | /** 35 | * @throws OutOfBoundsException if number of bits is invalid 36 | */ 37 | public static function forBits(int $bits) : self 38 | { 39 | switch ($bits) { 40 | case 0: 41 | return self::M(); 42 | 43 | case 1: 44 | return self::L(); 45 | 46 | case 2: 47 | return self::H(); 48 | 49 | case 3: 50 | return self::Q(); 51 | } 52 | 53 | throw new OutOfBoundsException('Invalid number of bits'); 54 | } 55 | 56 | /** 57 | * Returns the two bits used to encode this error correction level. 58 | */ 59 | public function getBits() : int 60 | { 61 | return $this->bits; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /authenticator/forms/auth/login.php: -------------------------------------------------------------------------------- 1 | [ 6 | 'label' => 'login.username.label', 7 | 'type' => 'text', 8 | 'icon' => 'user', 9 | 'required' => true, 10 | 'autofocus' => true, 11 | 'default' => s::get('kirby_panel_username') 12 | ], 13 | 'password' => [ 14 | 'label' => 'login.password.label', 15 | 'type' => 'password', 16 | 'required' => true 17 | ] 18 | ]; 19 | 20 | if ($canUseBackupCode) { 21 | $fields['backup_code'] = [ 22 | 'label' => 'authenticator.backupCode.label', 23 | 'type' => 'text', 24 | 'icon' => 'shield', 25 | 'placeholder' => null, 26 | 'help' => 'authenticator.backupCode.help' 27 | ]; 28 | } else { 29 | $fields['security_code'] = [ 30 | 'label' => 'authenticator.securityCode.label', 31 | 'type' => 'number', 32 | 'icon' => 'shield', 33 | 'placeholder' => null, 34 | 'min' => 1, 35 | 'max' => 999999, 36 | 'help' => 'authenticator.securityCode.help' 37 | ]; 38 | } 39 | 40 | $form = new Kirby\Panel\Form($fields); 41 | 42 | $form->attr('autocomplete', 'off'); 43 | $form->data('autosubmit', 'native'); 44 | $form->style('centered'); 45 | 46 | $form->buttons->submit->value = l('login.button'); 47 | 48 | return $form; 49 | }; 50 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-php56/bootstrap.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Symfony\Polyfill\Php56 as p; 13 | 14 | if (PHP_VERSION_ID < 50600) { 15 | if (!function_exists('hash_equals')) { 16 | function hash_equals($knownString, $userInput) { return p\Php56::hash_equals($knownString, $userInput); } 17 | } 18 | if (extension_loaded('ldap') && !function_exists('ldap_escape')) { 19 | define('LDAP_ESCAPE_FILTER', 1); 20 | define('LDAP_ESCAPE_DN', 2); 21 | 22 | function ldap_escape($subject, $ignore = '', $flags = 0) { return p\Php56::ldap_escape($subject, $ignore, $flags); } 23 | } 24 | 25 | if (50509 === PHP_VERSION_ID && 4 === PHP_INT_SIZE) { 26 | // Missing functions in PHP 5.5.9 - affects 32 bit builds of Ubuntu 14.04LTS 27 | // See https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1315888 28 | if (!function_exists('gzopen') && function_exists('gzopen64')) { 29 | function gzopen($filename, $mode, $use_include_path = 0) { return gzopen64($filename, $mode, $use_include_path); } 30 | } 31 | if (!function_exists('gzseek') && function_exists('gzseek64')) { 32 | function gzseek($zp, $offset, $whence = SEEK_SET) { return gzseek64($zp, $offset, $whence); } 33 | } 34 | if (!function_exists('gztell') && function_exists('gztell64')) { 35 | function gztell($zp) { return gztell64($zp); } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/tests/Base32Test.php: -------------------------------------------------------------------------------- 1 | assertSame( 20 | $random, 21 | Base32::decode($enc) 22 | ); 23 | $unpadded = \rtrim($enc, '='); 24 | $this->assertSame( 25 | $unpadded, 26 | Base32::encodeUnpadded($random) 27 | ); 28 | $this->assertSame( 29 | $random, 30 | Base32::decode($unpadded) 31 | ); 32 | 33 | $enc = Base32::encodeUpper($random); 34 | $this->assertSame( 35 | $random, 36 | Base32::decodeUpper($enc) 37 | ); 38 | $unpadded = \rtrim($enc, '='); 39 | $this->assertSame( 40 | $unpadded, 41 | Base32::encodeUpperUnpadded($random) 42 | ); 43 | $this->assertSame( 44 | $random, 45 | Base32::decodeUpper($unpadded) 46 | ); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /authenticator/fields/qrcode/qrcode.php: -------------------------------------------------------------------------------- 1 | [ 12 | 'qrcode.css' 13 | ] 14 | ]; 15 | 16 | public function result() 17 | { 18 | return null; 19 | } 20 | 21 | public function element() 22 | { 23 | $element = parent::element(); 24 | $element->addClass('field-with-icon'); 25 | 26 | return $element; 27 | } 28 | 29 | public function qrcode() 30 | { 31 | if (! $this->code()) { 32 | return; 33 | } 34 | 35 | $size = $this->size() ? $this->size() : 200; 36 | 37 | $renderer = new ImageRenderer( 38 | new RendererStyle($size), 39 | new SvgImageBackEnd() 40 | ); 41 | 42 | $writer = new Writer($renderer); 43 | 44 | return $writer->writeString($this->code()); 45 | } 46 | 47 | public function image() 48 | { 49 | if (! $this->code()) { 50 | return; 51 | } 52 | 53 | $image = new Brick('div'); 54 | $image->addClass('qrcode'); 55 | $image->append($this->qrcode()); 56 | 57 | return $image; 58 | } 59 | 60 | public function input() 61 | { 62 | $wrapper = new Brick('div'); 63 | $wrapper->addClass('text'); 64 | $wrapper->append(kirbytext($this->i18n($this->text()))); 65 | $wrapper->append($this->image()); 66 | 67 | return $wrapper; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/tests/Base32HexTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 20 | $random, 21 | Base32Hex::decode($enc) 22 | ); 23 | $unpadded = \rtrim($enc, '='); 24 | $this->assertSame( 25 | $unpadded, 26 | Base32Hex::encodeUnpadded($random) 27 | ); 28 | $this->assertSame( 29 | $random, 30 | Base32Hex::decode($unpadded) 31 | ); 32 | 33 | $enc = Base32Hex::encodeUpper($random); 34 | $this->assertSame( 35 | $random, 36 | Base32Hex::decodeUpper($enc) 37 | ); $unpadded = \rtrim($enc, '='); 38 | $this->assertSame( 39 | $unpadded, 40 | Base32Hex::encodeUpperUnpadded($random) 41 | ); 42 | $this->assertSame( 43 | $random, 44 | Base32Hex::decodeUpper($unpadded) 45 | ); 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-util/BinaryNoFuncOverload.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Polyfill\Util; 13 | 14 | /** 15 | * @author Nicolas Grekas 16 | * 17 | * @internal 18 | */ 19 | class BinaryNoFuncOverload 20 | { 21 | public static function strlen($s) 22 | { 23 | return \strlen($s); 24 | } 25 | 26 | public static function strpos($haystack, $needle, $offset = 0) 27 | { 28 | return strpos($haystack, $needle, $offset); 29 | } 30 | 31 | public static function strrpos($haystack, $needle, $offset = 0) 32 | { 33 | return strrpos($haystack, $needle, $offset); 34 | } 35 | 36 | public static function substr($string, $start, $length = PHP_INT_MAX) 37 | { 38 | return substr($string, $start, $length); 39 | } 40 | 41 | public static function stripos($s, $needle, $offset = 0) 42 | { 43 | return stripos($s, $needle, $offset); 44 | } 45 | 46 | public static function stristr($s, $needle, $part = false) 47 | { 48 | return stristr($s, $needle, $part); 49 | } 50 | 51 | public static function strrchr($s, $needle, $part = false) 52 | { 53 | return strrchr($s, $needle, $part); 54 | } 55 | 56 | public static function strripos($s, $needle, $offset = 0) 57 | { 58 | return strripos($s, $needle, $offset); 59 | } 60 | 61 | public static function strstr($s, $needle, $part = false) 62 | { 63 | return strstr($s, $needle, $part); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/tests/Base64UrlSafeTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 26 | $random, 27 | Base64UrlSafe::decode($enc) 28 | ); 29 | $this->assertSame( 30 | \strtr(\base64_encode($random), '+/', '-_'), 31 | $enc 32 | ); 33 | 34 | $unpadded = \rtrim($enc, '='); 35 | $this->assertSame( 36 | $unpadded, 37 | Base64UrlSafe::encodeUnpadded($random) 38 | ); 39 | $this->assertSame( 40 | $random, 41 | Base64UrlSafe::decode($unpadded) 42 | ); 43 | } 44 | } 45 | 46 | $random = \random_bytes(1 << 20); 47 | $enc = Base64UrlSafe::encode($random); 48 | $this->assertTrue(Binary::safeStrlen($enc) > 65536); 49 | $this->assertSame( 50 | $random, 51 | Base64UrlSafe::decode($enc) 52 | ); 53 | $this->assertSame( 54 | \strtr(\base64_encode($random), '+/', '-_'), 55 | $enc 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/README.md: -------------------------------------------------------------------------------- 1 | # QR Code generator 2 | 3 | [![Build Status](https://api.travis-ci.org/Bacon/BaconQrCode.png?branch=master)](http://travis-ci.org/Bacon/BaconQrCode) 4 | [![Coverage Status](https://coveralls.io/repos/github/Bacon/BaconQrCode/badge.svg?branch=master)](https://coveralls.io/github/Bacon/BaconQrCode?branch=master) 5 | [![Latest Stable Version](https://poser.pugx.org/bacon/bacon-qr-code/v/stable)](https://packagist.org/packages/bacon/bacon-qr-code) 6 | [![Total Downloads](https://poser.pugx.org/bacon/bacon-qr-code/downloads)](https://packagist.org/packages/bacon/bacon-qr-code) 7 | [![License](https://poser.pugx.org/bacon/bacon-qr-code/license)](https://packagist.org/packages/bacon/bacon-qr-code) 8 | 9 | 10 | ## Introduction 11 | BaconQrCode is a port of QR code portion of the ZXing library. It currently 12 | only features the encoder part, but could later receive the decoder part as 13 | well. 14 | 15 | As the Reed Solomon codec implementation of the ZXing library performs quite 16 | slow in PHP, it was exchanged with the implementation by Phil Karn. 17 | 18 | 19 | ## Example usage 20 | ```php 21 | use BaconQrCode\Renderer\ImageRenderer; 22 | use BaconQrCode\Renderer\Image\ImagickImageBackEnd; 23 | use BaconQrCode\Renderer\RendererStyle\RendererStyle; 24 | use BaconQrCode\Writer; 25 | 26 | $renderer = new ImageRenderer( 27 | new RendererStyle(400), 28 | new ImagickImageBackEnd() 29 | ); 30 | $writer = new Writer($renderer); 31 | $writer->writeFile('Hello World!', 'qrcode.png'); 32 | ``` 33 | 34 | ## Available image renderer back ends 35 | BaconQrCode comes with multiple back ends for rendering images. Currently included are the following: 36 | 37 | - `ImagickImageBackEnd`: renders raster images using the Imagick library 38 | - `SvgImageBackEnd`: renders SVG files using XMLWriter 39 | - `EpsImageBackEnd`: renders EPS files 40 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/other/build_phar.php: -------------------------------------------------------------------------------- 1 | buildFromDirectory(dirname(__DIR__).'/lib'); 19 | rename( 20 | dirname(__DIR__).'/lib/index.php', 21 | dirname(__DIR__).'/lib/random.php' 22 | ); 23 | 24 | /** 25 | * If we pass an (optional) path to a private key as a second argument, we will 26 | * sign the Phar with OpenSSL. 27 | * 28 | * If you leave this out, it will produce an unsigned .phar! 29 | */ 30 | if ($argc > 1) { 31 | if (!@is_readable($argv[1])) { 32 | echo 'Could not read the private key file:', $argv[1], "\n"; 33 | exit(255); 34 | } 35 | $pkeyFile = file_get_contents($argv[1]); 36 | 37 | $private = openssl_get_privatekey($pkeyFile); 38 | if ($private !== false) { 39 | $pkey = ''; 40 | openssl_pkey_export($private, $pkey); 41 | $phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey); 42 | 43 | /** 44 | * Save the corresponding public key to the file 45 | */ 46 | if (!@is_readable($dist.'/random_compat.phar.pubkey')) { 47 | $details = openssl_pkey_get_details($private); 48 | file_put_contents( 49 | $dist.'/random_compat.phar.pubkey', 50 | $details['key'] 51 | ); 52 | } 53 | } else { 54 | echo 'An error occurred reading the private key from OpenSSL.', "\n"; 55 | exit(255); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Path/Curve.php: -------------------------------------------------------------------------------- 1 | x1 = $x1; 41 | $this->y1 = $y1; 42 | $this->x2 = $x2; 43 | $this->y2 = $y2; 44 | $this->x3 = $x3; 45 | $this->y3 = $y3; 46 | } 47 | 48 | public function getX1() : float 49 | { 50 | return $this->x1; 51 | } 52 | 53 | public function getY1() : float 54 | { 55 | return $this->y1; 56 | } 57 | 58 | public function getX2() : float 59 | { 60 | return $this->x2; 61 | } 62 | 63 | public function getY2() : float 64 | { 65 | return $this->y2; 66 | } 67 | 68 | public function getX3() : float 69 | { 70 | return $this->x3; 71 | } 72 | 73 | public function getY3() : float 74 | { 75 | return $this->y3; 76 | } 77 | 78 | /** 79 | * @return self 80 | */ 81 | public function translate(float $x, float $y) : OperationInterface 82 | { 83 | return new self( 84 | $this->x1 + $x, 85 | $this->y1 + $y, 86 | $this->x2 + $x, 87 | $this->y2 + $y, 88 | $this->x3 + $x, 89 | $this->y3 + $y 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /authenticator/forms/settings/turn-on.php: -------------------------------------------------------------------------------- 1 | [ 6 | 'label' => 'authenticator.turnOn.label', 7 | 'type' => 'info', 8 | 'text' => l('authenticator.turnOn.text', [ 9 | 'ios' => 'iOS', 10 | 'android' => 'Android', 11 | 'windows' => 'Windows Mobile' 12 | ]) 13 | ], 14 | 'qrcode' => [ 15 | 'label' => 'authenticator.turnOn.qrcode.label', 16 | 'type' => 'qrcode', 17 | 'text' => 'authenticator.turnOn.qrcode.text', 18 | 'code' => $url, 19 | 'size' => 150 20 | ], 21 | // TODO: Require security code confirmation 22 | 'security_code' => [ 23 | 'label' => 'authenticator.securityCode.confirmation.label', 24 | 'type' => 'number', 25 | 'icon' => 'shield', 26 | 'placeholder' => null, 27 | 'min' => 1, 28 | 'max' => 999999, 29 | 'help' => 'authenticator.securityCode.help', 30 | 'required' => true, 31 | 'autofocus' => true 32 | ] 33 | ]); 34 | 35 | $form->attr('autocomplete', 'off'); 36 | $form->data('autosubmit', 'native'); 37 | 38 | $form->cancel('users/' . $user->username . '/edit'); 39 | 40 | $form->buttons->submit->addClass('btn-positive'); 41 | $form->buttons->submit->value = l('authenticator.toggle.on'); 42 | 43 | return $form; 44 | }; 45 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/lib/error_polyfill.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Polyfill\Util; 13 | 14 | /** 15 | * Binary safe version of string functions overloaded when MB_OVERLOAD_STRING is enabled. 16 | * 17 | * @author Nicolas Grekas 18 | * 19 | * @internal 20 | */ 21 | class BinaryOnFuncOverload 22 | { 23 | public static function strlen($s) 24 | { 25 | return mb_strlen($s, '8bit'); 26 | } 27 | 28 | public static function strpos($haystack, $needle, $offset = 0) 29 | { 30 | return mb_strpos($haystack, $needle, $offset, '8bit'); 31 | } 32 | 33 | public static function strrpos($haystack, $needle, $offset = 0) 34 | { 35 | return mb_strrpos($haystack, $needle, $offset, '8bit'); 36 | } 37 | 38 | public static function substr($string, $start, $length = 2147483647) 39 | { 40 | return mb_substr($string, $start, $length, '8bit'); 41 | } 42 | 43 | public static function stripos($s, $needle, $offset = 0) 44 | { 45 | return mb_stripos($s, $needle, $offset, '8bit'); 46 | } 47 | 48 | public static function stristr($s, $needle, $part = false) 49 | { 50 | return mb_stristr($s, $needle, $part, '8bit'); 51 | } 52 | 53 | public static function strrchr($s, $needle, $part = false) 54 | { 55 | return mb_strrchr($s, $needle, $part, '8bit'); 56 | } 57 | 58 | public static function strripos($s, $needle, $offset = 0) 59 | { 60 | return mb_strripos($s, $needle, $offset, '8bit'); 61 | } 62 | 63 | public static function strstr($s, $needle, $part = false) 64 | { 65 | return mb_strstr($s, $needle, $part, '8bit'); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vendor/dasprid/enum/test/Planet.php: -------------------------------------------------------------------------------- 1 | mass = $mass; 51 | $this->radius = $radius; 52 | } 53 | 54 | public function mass() : float 55 | { 56 | return $this->mass; 57 | } 58 | 59 | public function radius() : float 60 | { 61 | return $this->radius; 62 | } 63 | 64 | public function surfaceGravity() : float 65 | { 66 | return self::G * $this->mass / ($this->radius * $this->radius); 67 | } 68 | 69 | public function surfaceWeight(float $otherMass) : float 70 | { 71 | return $otherMass * $this->surfaceGravity(); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Common/EcBlocks.php: -------------------------------------------------------------------------------- 1 | ecCodewordsPerBlock = $ecCodewordsPerBlock; 32 | $this->ecBlocks = $ecBlocks; 33 | } 34 | 35 | /** 36 | * Returns the number of EC codewords per block. 37 | */ 38 | public function getEcCodewordsPerBlock() : int 39 | { 40 | return $this->ecCodewordsPerBlock; 41 | } 42 | 43 | /** 44 | * Returns the total number of EC block appearances. 45 | */ 46 | public function getNumBlocks() : int 47 | { 48 | $total = 0; 49 | 50 | foreach ($this->ecBlocks as $ecBlock) { 51 | $total += $ecBlock->getCount(); 52 | } 53 | 54 | return $total; 55 | } 56 | 57 | /** 58 | * Returns the total count of EC codewords. 59 | */ 60 | public function getTotalEcCodewords() : int 61 | { 62 | return $this->ecCodewordsPerBlock * $this->getNumBlocks(); 63 | } 64 | 65 | /** 66 | * Returns the EC blocks included in this collection. 67 | * 68 | * @return EcBlock[] 69 | */ 70 | public function getEcBlocks() : array 71 | { 72 | return $this->ecBlocks; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Writer.php: -------------------------------------------------------------------------------- 1 | renderer = $renderer; 29 | } 30 | 31 | /** 32 | * Writes QR code and returns it as string. 33 | * 34 | * Content is a string which *should* be encoded in UTF-8, in case there are 35 | * non ASCII-characters present. 36 | * 37 | * @throws InvalidArgumentException if the content is empty 38 | */ 39 | public function writeString( 40 | string $content, 41 | string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, 42 | ?ErrorCorrectionLevel $ecLevel = null 43 | ) : string { 44 | if (strlen($content) === 0) { 45 | throw new InvalidArgumentException('Found empty contents'); 46 | } 47 | 48 | if (null === $ecLevel) { 49 | $ecLevel = ErrorCorrectionLevel::L(); 50 | } 51 | 52 | return $this->renderer->render(Encoder::encode($content, $ecLevel, $encoding)); 53 | } 54 | 55 | /** 56 | * Writes QR code to a file. 57 | * 58 | * @see Writer::writeString() 59 | */ 60 | public function writeFile( 61 | string $content, 62 | string $filename, 63 | string $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, 64 | ?ErrorCorrectionLevel $ecLevel = null 65 | ) : void { 66 | file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel)); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/EyeFill.php: -------------------------------------------------------------------------------- 1 | externalColor = $externalColor; 29 | $this->internalColor = $internalColor; 30 | } 31 | 32 | public static function uniform(ColorInterface $color) : self 33 | { 34 | return new self($color, $color); 35 | } 36 | 37 | public static function inherit() : self 38 | { 39 | return self::$inherit ?: self::$inherit = new self(null, null); 40 | } 41 | 42 | public function inheritsBothColors() : bool 43 | { 44 | return null === $this->externalColor && null === $this->internalColor; 45 | } 46 | 47 | public function inheritsExternalColor() : bool 48 | { 49 | return null === $this->externalColor; 50 | } 51 | 52 | public function inheritsInternalColor() : bool 53 | { 54 | return null === $this->internalColor; 55 | } 56 | 57 | public function getExternalColor() : ColorInterface 58 | { 59 | if (null === $this->externalColor) { 60 | throw new RuntimeException('External eye color inherits foreground color'); 61 | } 62 | 63 | return $this->externalColor; 64 | } 65 | 66 | public function getInternalColor() : ColorInterface 67 | { 68 | if (null === $this->internalColor) { 69 | throw new RuntimeException('Internal eye color inherits foreground color'); 70 | } 71 | 72 | return $this->internalColor; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Module/DotsModule.php: -------------------------------------------------------------------------------- 1 | 1) { 27 | throw new InvalidArgumentException('Size must between 0 (exclusive) and 1 (inclusive)'); 28 | } 29 | 30 | $this->size = $size; 31 | } 32 | 33 | public function createPath(ByteMatrix $matrix) : Path 34 | { 35 | $width = $matrix->getWidth(); 36 | $height = $matrix->getHeight(); 37 | $path = new Path(); 38 | $halfSize = $this->size / 2; 39 | $margin = (1 - $this->size) / 2; 40 | 41 | for ($y = 0; $y < $height; ++$y) { 42 | for ($x = 0; $x < $width; ++$x) { 43 | if (! $matrix->get($x, $y)) { 44 | continue; 45 | } 46 | 47 | $pathX = $x + $margin; 48 | $pathY = $y + $margin; 49 | 50 | $path = $path 51 | ->move($pathX + $this->size, $pathY + $halfSize) 52 | ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX + $halfSize, $pathY + $this->size) 53 | ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX, $pathY + $halfSize) 54 | ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX + $halfSize, $pathY) 55 | ->ellipticArc($halfSize, $halfSize, 0, false, true, $pathX + $this->size, $pathY + $halfSize) 56 | ->close() 57 | ; 58 | } 59 | } 60 | 61 | return $path; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/RendererStyle/RendererStyle.php: -------------------------------------------------------------------------------- 1 | margin = $margin; 46 | $this->size = $size; 47 | $this->module = $module ?: SquareModule::instance(); 48 | $this->eye = $eye ?: new ModuleEye($this->module); 49 | $this->fill = $fill ?: Fill::default(); 50 | } 51 | 52 | public function withSize(int $size) : self 53 | { 54 | $style = clone $this; 55 | $style->size = $size; 56 | return $style; 57 | } 58 | 59 | public function withMargin(int $margin) : self 60 | { 61 | $style = clone $this; 62 | $style->margin = $margin; 63 | return $style; 64 | } 65 | 66 | public function getSize() : int 67 | { 68 | return $this->size; 69 | } 70 | 71 | public function getMargin() : int 72 | { 73 | return $this->margin; 74 | } 75 | 76 | public function getModule() : ModuleInterface 77 | { 78 | return $this->module; 79 | } 80 | 81 | public function getEye() : EyeInterface 82 | { 83 | return $this->eye; 84 | } 85 | 86 | public function getFill() : Fill 87 | { 88 | return $this->fill; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/src/EncoderInterface.php: -------------------------------------------------------------------------------- 1 | values = [1, 0, 0, 1, 0, 0]; 16 | } 17 | 18 | public function multiply(self $other) : self 19 | { 20 | $matrix = new self(); 21 | $matrix->values[0] = $this->values[0] * $other->values[0] + $this->values[2] * $other->values[1]; 22 | $matrix->values[1] = $this->values[1] * $other->values[0] + $this->values[3] * $other->values[1]; 23 | $matrix->values[2] = $this->values[0] * $other->values[2] + $this->values[2] * $other->values[3]; 24 | $matrix->values[3] = $this->values[1] * $other->values[2] + $this->values[3] * $other->values[3]; 25 | $matrix->values[4] = $this->values[0] * $other->values[4] + $this->values[2] * $other->values[5] 26 | + $this->values[4]; 27 | $matrix->values[5] = $this->values[1] * $other->values[4] + $this->values[3] * $other->values[5] 28 | + $this->values[5]; 29 | 30 | return $matrix; 31 | } 32 | 33 | public static function scale(float $size) : self 34 | { 35 | $matrix = new self(); 36 | $matrix->values = [$size, 0, 0, $size, 0, 0]; 37 | return $matrix; 38 | } 39 | 40 | public static function translate(float $x, float $y) : self 41 | { 42 | $matrix = new self(); 43 | $matrix->values = [1, 0, 0, 1, $x, $y]; 44 | return $matrix; 45 | } 46 | 47 | public static function rotate(int $degrees) : self 48 | { 49 | $matrix = new self(); 50 | $matrix->values = [cos($degrees), sin($degrees), -sin($degrees), cos($degrees), 0, 0]; 51 | return $matrix; 52 | } 53 | 54 | 55 | /** 56 | * Applies this matrix onto a point and returns the resulting viewport point. 57 | * 58 | * @return float[] 59 | */ 60 | public function apply(float $x, float $y) : array 61 | { 62 | return [ 63 | $x * $this->values[0] + $y * $this->values[2] + $this->values[4], 64 | $x * $this->values[2] + $x * $this->values[3] + $this->values[5], 65 | ]; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Color/Rgb.php: -------------------------------------------------------------------------------- 1 | 255) { 33 | throw new Exception\InvalidArgumentException('Red must be between 0 and 255'); 34 | } 35 | 36 | if ($green < 0 || $green > 255) { 37 | throw new Exception\InvalidArgumentException('Green must be between 0 and 255'); 38 | } 39 | 40 | if ($blue < 0 || $blue > 255) { 41 | throw new Exception\InvalidArgumentException('Blue must be between 0 and 255'); 42 | } 43 | 44 | $this->red = $red; 45 | $this->green = $green; 46 | $this->blue = $blue; 47 | } 48 | 49 | public function getRed() : int 50 | { 51 | return $this->red; 52 | } 53 | 54 | public function getGreen() : int 55 | { 56 | return $this->green; 57 | } 58 | 59 | public function getBlue() : int 60 | { 61 | return $this->blue; 62 | } 63 | 64 | public function toRgb() : Rgb 65 | { 66 | return $this; 67 | } 68 | 69 | public function toCmyk() : Cmyk 70 | { 71 | $c = 1 - ($this->red / 255); 72 | $m = 1 - ($this->green / 255); 73 | $y = 1 - ($this->blue / 255); 74 | $k = min($c, $m, $y); 75 | 76 | return new Cmyk( 77 | (int) (100 * ($c - $k) / (1 - $k)), 78 | (int) (100 * ($m - $k) / (1 - $k)), 79 | (int) (100 * ($y - $k) / (1 - $k)), 80 | (int) (100 * $k) 81 | ); 82 | } 83 | 84 | public function toGray() : Gray 85 | { 86 | return new Gray((int) (($this->red * 0.21 + $this->green * 0.71 + $this->blue * 0.07) / 2.55)); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/changelog.md: -------------------------------------------------------------------------------- 1 | ## Change Log 2 | 3 | ## [3.0.1] - 2018-03-15 4 | ### Changed 5 | - Relicensed to MIT 6 | 7 | ## [3.0.0] - 2018-03-07 8 | ### Changed 9 | - It's now mandatory to enable Google Api secret key access by executing `setAllowInsecureCallToGoogleApis(true);` 10 | 11 | ## [2.0.4] - 2017-06-22 12 | ### Fixed 13 | - Fix Base32 to keep supporting PHP 5.4 && 5.5. 14 | 15 | ## [2.0.3] - 2017-06-22 16 | ## [2.0.2] - 2017-06-21 17 | ## [2.0.1] - 2017-06-20 18 | ### Fixed 19 | - Minor bugs 20 | 21 | ## [2.0.0] - 2017-06-20 22 | ### Changed 23 | - Drop the Laravel support in favor of a bridge package (https://github.com/antonioribeiro/google2fa-laravel). 24 | - Using a more secure Base 32 algorithm, to prevent cache-timing attacks. 25 | - Added verifyKeyNewer() method to prevent reuse of keys. 26 | - Refactored to remove complexity, by extracting support methods. 27 | - Created a package playground page (https://pragmarx.com/google2fa) 28 | 29 | ## [2.0.0] - 2017-06-20 30 | ### Changed 31 | - Drop the Laravel support in favor of a bridge package (https://github.com/antonioribeiro/google2fa-laravel). 32 | - Using a more secure Base 32 algorithm, to prevent cache-timing attacks. 33 | - Added verifyKeyNewer() method to prevent reuse of keys. 34 | - Refactored to remove complexity, by extracting support methods. 35 | - Created a package playground page (https://pragmarx.com/google2fa) 36 | 37 | ## [1.0.1] - 2016-07-18 38 | ### Changed 39 | - Drop support for PHP 5.3.7, require PHP 5.4+. 40 | - Coding style is now PSR-2 automatically enforced by StyleCI. 41 | 42 | ## [1.0.0] - 2016-07-17 43 | ### Changed 44 | - Package bacon/bacon-qr-code was moved to "suggest". 45 | 46 | ## [0.8.1] - 2016-07-17 47 | ### Fixed 48 | - Allow paragonie/random_compat ~1.4|~2.0. 49 | 50 | ## [0.8.0] - 2016-07-17 51 | ### Changed 52 | - Bumped christian-riesen/base32 to ~1.3 53 | - Use paragonie/random_compat to generate cryptographically secure random secret keys 54 | - Readme improvements 55 | - Drop simple-qrcode in favor of bacon/bacon-qr-code 56 | - Fix tavis setup for phpspec, PHP 7, hhvm and improve cache 57 | 58 | ## [0.7.0] - 2015-11-07 59 | ### Changed 60 | - Fixed URL generation for QRCodes 61 | - Avoid time attacks 62 | 63 | ## [0.2.0] - 2015-02-19 64 | ### Changed 65 | - Laravel 5 compatibility. 66 | 67 | ## [0.1.0] - 2014-07-06 68 | ### Added 69 | - First version. 70 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Common/Mode.php: -------------------------------------------------------------------------------- 1 | characterCountBitsForVersions = $characterCountBitsForVersions; 48 | $this->bits = $bits; 49 | } 50 | 51 | /** 52 | * Returns the number of bits used in a specific QR code version. 53 | */ 54 | public function getCharacterCountBits(Version $version) : int 55 | { 56 | $number = $version->getVersionNumber(); 57 | 58 | if ($number <= 9) { 59 | $offset = 0; 60 | } elseif ($number <= 26) { 61 | $offset = 1; 62 | } else { 63 | $offset = 2; 64 | } 65 | 66 | return $this->characterCountBitsForVersions[$offset]; 67 | } 68 | 69 | /** 70 | * Returns the four bits used to encode this mode. 71 | */ 72 | public function getBits() : int 73 | { 74 | return $this->bits; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /authenticator/fields/authenticator/authenticator.php: -------------------------------------------------------------------------------- 1 | [ 7 | 'authenticator.css' 8 | ] 9 | ]; 10 | 11 | public function isOn() 12 | { 13 | return 16 === strlen($this->model()->authenticatorsecret); 14 | } 15 | 16 | public function label() 17 | { 18 | $status = $this->isOn() 19 | ? '' . l('authenticator.field.status.on') . '' 20 | : '' . l('authenticator.field.status.off') . ''; 21 | 22 | $label = new Brick('label', l('authenticator.field.label', compact('status'))); 23 | $label->addClass('label'); 24 | 25 | return $label; 26 | } 27 | 28 | public function help() 29 | { 30 | $text = $this->isOn() 31 | ? l('authenticator.field.info.on') 32 | : l('authenticator.field.info.off'); 33 | 34 | $help = new Brick('div', $text); 35 | $help->addClass('field-help marginalia text'); 36 | 37 | return $help; 38 | } 39 | 40 | public function content() 41 | { 42 | if (! $this->canEdit()) { 43 | return null; 44 | } 45 | 46 | $username = $this->model()->username; 47 | 48 | $action = $this->isOn() ? 'off' : 'on'; 49 | $icon = $this->isOn() ? 'fa-toggle-off' : 'fa-toggle-on'; 50 | $text = $this->isOn() ? l('authenticator.toggle.off') : l('authenticator.toggle.on'); 51 | 52 | $button = new Brick('a'); 53 | $button->addClass('label-option'); 54 | $button->data('modal', true); 55 | $button->attr('href', purl('users/' . $username . '/two-steps/' . $action)); 56 | $button->html('' . $text); 57 | 58 | return $button; 59 | } 60 | 61 | public function element() 62 | { 63 | $status = $this->isOn() 64 | ? 'two-steps--on' 65 | : 'two-steps--off'; 66 | 67 | return parent::element()->addClass($status); 68 | } 69 | 70 | protected function canEdit() 71 | { 72 | // TODO: allow admin to enable/disable two-step login for other users 73 | // return $this->model()->username == site()->user() || site()->user()->isAdmin(); 74 | return $this->model()->username == site()->user(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-util/LegacyTestListener.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Polyfill\Util; 13 | 14 | /** 15 | * @author Nicolas Grekas 16 | */ 17 | class LegacyTestListener extends \PHPUnit_Framework_TestSuite implements \PHPUnit_Framework_TestListener 18 | { 19 | private $suite; 20 | private $trait; 21 | 22 | public function __construct(\PHPUnit_Framework_TestSuite $suite = null) 23 | { 24 | if ($suite) { 25 | $this->suite = $suite; 26 | $this->setName($suite->getName().' with polyfills enabled'); 27 | $this->addTest($suite); 28 | } 29 | $this->trait = new TestListenerTrait(); 30 | } 31 | 32 | public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) 33 | { 34 | $this->trait->startTestSuite($suite); 35 | } 36 | 37 | protected function setUp() 38 | { 39 | TestListenerTrait::$enabledPolyfills = $this->suite->getName(); 40 | } 41 | 42 | protected function tearDown() 43 | { 44 | TestListenerTrait::$enabledPolyfills = false; 45 | } 46 | 47 | public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) 48 | { 49 | $this->trait->addError($test, $e, $time); 50 | } 51 | 52 | public function addWarning(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, $time) 53 | { 54 | } 55 | 56 | public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time) 57 | { 58 | $this->trait->addError($test, $e, $time); 59 | } 60 | 61 | public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) 62 | { 63 | } 64 | 65 | public function addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) 66 | { 67 | } 68 | 69 | public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) 70 | { 71 | } 72 | 73 | public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) 74 | { 75 | } 76 | 77 | public function startTest(\PHPUnit_Framework_Test $test) 78 | { 79 | } 80 | 81 | public function endTest(\PHPUnit_Framework_Test $test, $time) 82 | { 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/PlainTextRenderer.php: -------------------------------------------------------------------------------- 1 | margin = $margin; 39 | } 40 | 41 | /** 42 | * @throws InvalidArgumentException if matrix width doesn't match height 43 | */ 44 | public function render(QrCode $qrCode) : string 45 | { 46 | $matrix = $qrCode->getMatrix(); 47 | $matrixSize = $matrix->getWidth(); 48 | 49 | if ($matrixSize !== $matrix->getHeight()) { 50 | throw new InvalidArgumentException('Matrix must have the same width and height'); 51 | } 52 | 53 | $rows = $matrix->getArray()->toArray(); 54 | 55 | if (0 !== $matrixSize % 2) { 56 | $rows[] = array_fill(0, $matrixSize, 0); 57 | } 58 | 59 | $horizontalMargin = str_repeat(self::EMPTY_BLOCK, $this->margin); 60 | $result = str_repeat("\n", (int) ceil($this->margin / 2)); 61 | 62 | for ($i = 0; $i < $matrixSize; $i += 2) { 63 | $result .= $horizontalMargin; 64 | 65 | $upperRow = $rows[$i]; 66 | $lowerRow = $rows[$i + 1]; 67 | 68 | for ($j = 0; $j < $matrixSize; ++$j) { 69 | $upperBit = $upperRow[$j]; 70 | $lowerBit = $lowerRow[$j]; 71 | 72 | if ($upperBit) { 73 | $result .= $lowerBit ? self::FULL_BLOCK : self::UPPER_HALF_BLOCK; 74 | } else { 75 | $result .= $lowerBit ? self::LOWER_HALF_BLOCK : self::EMPTY_BLOCK; 76 | } 77 | } 78 | 79 | $result .= $horizontalMargin . "\n"; 80 | } 81 | 82 | $result .= str_repeat("\n", (int) ceil($this->margin / 2)); 83 | 84 | return $result; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 - 2018 Paragon Initiative Enterprises 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | ------------------------------------------------------------------------------ 24 | This library was based on the work of Steve "Sc00bz" Thomas. 25 | ------------------------------------------------------------------------------ 26 | 27 | The MIT License (MIT) 28 | 29 | Copyright (c) 2014 Steve Thomas 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is 36 | furnished to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in all 39 | copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 47 | SOFTWARE. 48 | 49 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Module/EdgeIterator/Edge.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | private $points = []; 17 | 18 | /** 19 | * @var array|null 20 | */ 21 | private $simplifiedPoints; 22 | 23 | /** 24 | * @var int 25 | */ 26 | private $minX = PHP_INT_MAX; 27 | 28 | /** 29 | * @var int 30 | */ 31 | private $minY = PHP_INT_MAX; 32 | 33 | /** 34 | * @var int 35 | */ 36 | private $maxX = -1; 37 | 38 | /** 39 | * @var int 40 | */ 41 | private $maxY = -1; 42 | 43 | public function __construct(bool $positive) 44 | { 45 | $this->positive = $positive; 46 | } 47 | 48 | public function addPoint(int $x, int $y) : void 49 | { 50 | $this->points[] = [$x, $y]; 51 | $this->minX = min($this->minX, $x); 52 | $this->minY = min($this->minY, $y); 53 | $this->maxX = max($this->maxX, $x); 54 | $this->maxY = max($this->maxY, $y); 55 | } 56 | 57 | public function isPositive() : bool 58 | { 59 | return $this->positive; 60 | } 61 | 62 | /** 63 | * @return array 64 | */ 65 | public function getPoints() : array 66 | { 67 | return $this->points; 68 | } 69 | 70 | public function getMaxX() : int 71 | { 72 | return $this->maxX; 73 | } 74 | 75 | public function getSimplifiedPoints() : array 76 | { 77 | if (null !== $this->simplifiedPoints) { 78 | return $this->simplifiedPoints; 79 | } 80 | 81 | $points = []; 82 | $length = count($this->points); 83 | 84 | for ($i = 0; $i < $length; ++$i) { 85 | $previousPoint = $this->points[(0 === $i ? $length : $i) - 1]; 86 | $nextPoint = $this->points[($length - 1 === $i ? -1 : $i) + 1]; 87 | $currentPoint = $this->points[$i]; 88 | 89 | if (($previousPoint[0] === $currentPoint[0] && $currentPoint[0] === $nextPoint[0]) 90 | || ($previousPoint[1] === $currentPoint[1] && $currentPoint[1] === $nextPoint[1]) 91 | ) { 92 | continue; 93 | } 94 | 95 | $points[] = $currentPoint; 96 | } 97 | 98 | return $this->simplifiedPoints = $points; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/bootstrap.php: -------------------------------------------------------------------------------- 1 | set('field', 'authenticator', authenticator()->roots()->fields() . DS . 'authenticator'); 13 | kirby()->set('field', 'qrcode', authenticator()->roots()->fields() . DS . 'qrcode'); 14 | 15 | // Register users/default blueprint in case one does not exist inside site/blueprints 16 | if ( 17 | ! file_exists(kirby()->roots()->blueprints() . DS . 'users' . DS . 'default.yml') 18 | && ! file_exists(kirby()->roots()->blueprints() . DS . 'users' . DS . 'default.yaml') 19 | ) { 20 | kirby()->set( 21 | 'blueprint', 22 | 'users/default', 23 | authenticator()->roots()->blueprints() . DS . 'users' . DS . 'default.yml' 24 | ); 25 | } 26 | 27 | panel()->routes([ 28 | [ 29 | 'pattern' => '(login)', 30 | 'method' => 'GET|POST', 31 | 'filter' => 'isInstalled', 32 | 'action' => function () { 33 | return (new LoginController)->login(); 34 | } 35 | ], 36 | [ 37 | 'pattern' => 'login.css', 38 | 'method' => 'GET', 39 | 'action' => function () { 40 | require_once(panel()->roots()->controllers() . DS . 'assets.php'); 41 | 42 | return (new AssetsController)->other('authenticator', 'css/authenticator.css'); 43 | } 44 | ], 45 | [ 46 | 'pattern' => '(logout)', 47 | 'method' => 'GET', 48 | 'filter' => 'auth', 49 | 'action' => function () { 50 | return (new LoginController)->logout(); 51 | } 52 | ], 53 | [ 54 | 'pattern' => 'users/(:any)/two-steps/on', 55 | 'method' => 'GET|POST', 56 | 'filter' => 'auth', 57 | 'action' => function ($username) { 58 | return (new SettingsController)->turnOn($username); 59 | } 60 | ], 61 | [ 62 | 'pattern' => 'users/(:any)/two-steps/backup', 63 | 'method' => 'GET|POST', 64 | 'filter' => 'auth', 65 | 'action' => function ($username) { 66 | return (new SettingsController)->backup($username); 67 | } 68 | ], 69 | [ 70 | 'pattern' => 'users/(:any)/two-steps/off', 71 | 'method' => 'GET|POST', 72 | 'filter' => 'auth', 73 | 'action' => function ($username) { 74 | return (new SettingsController)->turnOff($username); 75 | } 76 | ], 77 | ]); 78 | -------------------------------------------------------------------------------- /vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInitc4c18db373ff26146736e56d851f765b::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | if ($useStaticLoader) { 51 | $includeFiles = Composer\Autoload\ComposerStaticInitc4c18db373ff26146736e56d851f765b::$files; 52 | } else { 53 | $includeFiles = require __DIR__ . '/autoload_files.php'; 54 | } 55 | foreach ($includeFiles as $fileIdentifier => $file) { 56 | composerRequirec4c18db373ff26146736e56d851f765b($fileIdentifier, $file); 57 | } 58 | 59 | return $loader; 60 | } 61 | } 62 | 63 | function composerRequirec4c18db373ff26146736e56d851f765b($fileIdentifier, $file) 64 | { 65 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 66 | require $file; 67 | 68 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /authenticator/translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticator.toggle.on": "Turn on", 3 | "authenticator.toggle.off": "Turn off", 4 | "authenticator.field.label": "2-step verification is {status}", 5 | "authenticator.field.status.on": "turned on", 6 | "authenticator.field.status.off": "turned off", 7 | "authenticator.field.info.on": "Account protected with security code in addition to password.", 8 | "authenticator.field.info.off": "Activate 2-step verification to level-up your account's security.
Once activated, you'll use both your password and a 6-digit security code sent to your phone to log in.", 9 | "authenticator.turnOn.label": "Turn on 2-step verification", 10 | "authenticator.turnOn.text": "An authenticator app lets you generate security codes on your phone. If you don’t already have one, install it now your device: {ios}, {android}, or {windows}.", 11 | "authenticator.turnOn.qrcode.label": "To configure your authenticator app:", 12 | "authenticator.turnOn.qrcode.text": "- Add a new time-based token\n- Use your app to scan the QR code below", 13 | "authenticator.turnOn.success": "2-step verification has been turned on", 14 | "authenticator.turnOn.error": "2-step verification could not be turned on", 15 | "authenticator.turnOff.label": "Do you really want to disable 2-step verification?", 16 | "authenticator.turnOff.text": "Turning off 2-step verification will remove the extra security on your account and you’ll only need your password to sign in.", 17 | "authenticator.turnOff.success": "2-step verification has been turned off", 18 | "authenticator.turnOff.error": "2-step verification could not be turned off", 19 | "authenticator.securityCode.confirmation.label": "Confirm your security code", 20 | "authenticator.securityCode.label": "Security code", 21 | "authenticator.securityCode.error": "Invalid or expired security code", 22 | "authenticator.securityCode.help": "Enter the 6-digit security code generated by your mobile authenticator app", 23 | "authenticator.backup.label": "Save the backup code", 24 | "authenticator.backup.text": "You can save a backup code to use when you don't have access to your mobile authenticator app. To do that, copy the code below and store it safely.", 25 | "authenticator.backup.note": "If you ever get locked out of your account, contact your website administrator.", 26 | "authenticator.backup.cancel": "No, thank you", 27 | "authenticator.backup.error": "Your backup code could not be saved", 28 | "authenticator.backupCode.label": "Backup code", 29 | "authenticator.backupCode.error": "Invalid backup code", 30 | "authenticator.backupCode.help": "Enter the backup code created when you enabled 2-step verification" 31 | } 32 | -------------------------------------------------------------------------------- /vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', 11 | 'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php', 12 | '4ae513dcd6c6781fd946d90523cfc740' => __DIR__ . '/../..' . '/src/bootstrap.php', 13 | ); 14 | 15 | public static $prefixLengthsPsr4 = array ( 16 | 'S' => 17 | array ( 18 | 'Symfony\\Polyfill\\Util\\' => 22, 19 | 'Symfony\\Polyfill\\Php56\\' => 23, 20 | ), 21 | 'P' => 22 | array ( 23 | 'PragmaRX\\Google2FA\\Tests\\' => 25, 24 | 'PragmaRX\\Google2FA\\' => 19, 25 | 'PedroBorges\\Authenticator\\' => 26, 26 | 'ParagonIE\\ConstantTime\\' => 23, 27 | ), 28 | 'D' => 29 | array ( 30 | 'DASPRiD\\Enum\\' => 13, 31 | ), 32 | 'B' => 33 | array ( 34 | 'BaconQrCode\\' => 12, 35 | ), 36 | ); 37 | 38 | public static $prefixDirsPsr4 = array ( 39 | 'Symfony\\Polyfill\\Util\\' => 40 | array ( 41 | 0 => __DIR__ . '/..' . '/symfony/polyfill-util', 42 | ), 43 | 'Symfony\\Polyfill\\Php56\\' => 44 | array ( 45 | 0 => __DIR__ . '/..' . '/symfony/polyfill-php56', 46 | ), 47 | 'PragmaRX\\Google2FA\\Tests\\' => 48 | array ( 49 | 0 => __DIR__ . '/..' . '/pragmarx/google2fa/tests', 50 | ), 51 | 'PragmaRX\\Google2FA\\' => 52 | array ( 53 | 0 => __DIR__ . '/..' . '/pragmarx/google2fa/src', 54 | ), 55 | 'PedroBorges\\Authenticator\\' => 56 | array ( 57 | 0 => __DIR__ . '/../..' . '/src', 58 | ), 59 | 'ParagonIE\\ConstantTime\\' => 60 | array ( 61 | 0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', 62 | ), 63 | 'DASPRiD\\Enum\\' => 64 | array ( 65 | 0 => __DIR__ . '/..' . '/dasprid/enum/src', 66 | ), 67 | 'BaconQrCode\\' => 68 | array ( 69 | 0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src', 70 | ), 71 | ); 72 | 73 | public static function getInitializer(ClassLoader $loader) 74 | { 75 | return \Closure::bind(function () use ($loader) { 76 | $loader->prefixLengthsPsr4 = ComposerStaticInitc4c18db373ff26146736e56d851f765b::$prefixLengthsPsr4; 77 | $loader->prefixDirsPsr4 = ComposerStaticInitc4c18db373ff26146736e56d851f765b::$prefixDirsPsr4; 78 | 79 | }, null, ClassLoader::class); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /authenticator/translations/nl_BE.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticator.toggle.on": "Activeren", 3 | "authenticator.toggle.off": "Uitschakelen", 4 | "authenticator.field.label": "2-factor authenticatie staat {status}", 5 | "authenticator.field.status.on": "aan", 6 | "authenticator.field.status.off": "af", 7 | "authenticator.field.info.on": "Account is beschermd met beveilingscode èn paswoord.", 8 | "authenticator.field.info.off": "Activeer 2-factor authenticatie om je account beter te beschermen.
Van zodra geactiveerd zul je een naast je paswoord een SMS ontvangen met een 6-cijferige om in te loggen.", 9 | "authenticator.turnOn.label": "2-factor authenticatie activeren", 10 | "authenticator.turnOn.text": "Een authenticator app kan beveilingscodes genereren op je smartphone. Wanneer je nog geen hebt, installeer nu één voor: {ios}, {android}, of {windows}.", 11 | "authenticator.turnOn.qrcode.label": "Om je authenticator app te configureren:", 12 | "authenticator.turnOn.qrcode.text": "- Tijdsafhankelijk token toevoegen\n- Gebruik je app om de QR code hieronder te scannen", 13 | "authenticator.turnOn.success": "2-factor authenticatie werd geactiveerd", 14 | "authenticator.turnOn.error": "2-factor authenticatie kan niet worden geactiveerd", 15 | "authenticator.turnOff.label": "Weet u zeker dat u 2-factor authenticatie wilt uitschakelen?", 16 | "authenticator.turnOff.text": "2-factor authenticatie uitschakelen zal alle extra beveiligingsmaatregelen op uw account verwijderen. Hierna heb je enkel je paswoord nodig om in te loggen.", 17 | "authenticator.turnOff.success": "2-factor authenticatie werd uitgeschakeld", 18 | "authenticator.turnOff.error": "2-factor authenticatie kan niet worden uitgeschakeld", 19 | "authenticator.securityCode.confirmation.label": "Beveilingscode bevestigen", 20 | "authenticator.securityCode.label": "Beveilingscode", 21 | "authenticator.securityCode.error": "Ongeldige of verlopen beveilingscode", 22 | "authenticator.securityCode.help": "Geef de 6-cijferige beveilingscode die werd gegenereerd door uw mobiele authenticator app", 23 | "authenticator.backup.label": "Backup code opslaan", 24 | "authenticator.backup.text": "U kan een backup code opslaan om te gebruiken wanneer u geen toegang hebt tot uw mobiele authenticator app. Om dit te doen, kopieer de onderstaande code en sla deze op een veilige locatie op.", 25 | "authenticator.backup.note": "Wanneer u ooit buitengesloten bent, contacteer de website administrator.", 26 | "authenticator.backup.cancel": "Nee, bedankt", 27 | "authenticator.backup.error": "Uw backup code kan niet worden opgeslaan", 28 | "authenticator.backupCode.label": "Backup code", 29 | "authenticator.backupCode.error": "Ongeldige backup code", 30 | "authenticator.backupCode.help": "Geef uw backup code in die werd aangemaakt wanneer u 2-factor authenticatie hebt geactiveerd" 31 | } 32 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Color/Cmyk.php: -------------------------------------------------------------------------------- 1 | 100) { 39 | throw new Exception\InvalidArgumentException('Cyan must be between 0 and 100'); 40 | } 41 | 42 | if ($magenta < 0 || $magenta > 100) { 43 | throw new Exception\InvalidArgumentException('Magenta must be between 0 and 100'); 44 | } 45 | 46 | if ($yellow < 0 || $yellow > 100) { 47 | throw new Exception\InvalidArgumentException('Yellow must be between 0 and 100'); 48 | } 49 | 50 | if ($black < 0 || $black > 100) { 51 | throw new Exception\InvalidArgumentException('Black must be between 0 and 100'); 52 | } 53 | 54 | $this->cyan = $cyan; 55 | $this->magenta = $magenta; 56 | $this->yellow = $yellow; 57 | $this->black = $black; 58 | } 59 | 60 | public function getCyan() : int 61 | { 62 | return $this->cyan; 63 | } 64 | 65 | public function getMagenta() : int 66 | { 67 | return $this->magenta; 68 | } 69 | 70 | public function getYellow() : int 71 | { 72 | return $this->yellow; 73 | } 74 | 75 | public function getBlack() : int 76 | { 77 | return $this->black; 78 | } 79 | 80 | public function toRgb() : Rgb 81 | { 82 | $k = $this->black / 100; 83 | $c = (-$k * $this->cyan + $k * 100 + $this->cyan) / 100; 84 | $m = (-$k * $this->magenta + $k * 100 + $this->magenta) / 100; 85 | $y = (-$k * $this->yellow + $k * 100 + $this->yellow) / 100; 86 | 87 | return new Rgb( 88 | (int) (-$c * 255 + 255), 89 | (int) (-$m * 255 + 255), 90 | (int) (-$y * 255 + 255) 91 | ); 92 | } 93 | 94 | public function toCmyk() : Cmyk 95 | { 96 | return $this; 97 | } 98 | 99 | public function toGray() : Gray 100 | { 101 | return $this->toRgb()->toGray(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /authenticator/translations/pt_BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "authenticator.toggle.on": "Ativar", 3 | "authenticator.toggle.off": "Desativar", 4 | "authenticator.field.label": "A verificação em duas etapas está {status}", 5 | "authenticator.field.status.on": "ativa", 6 | "authenticator.field.status.off": "desativada", 7 | "authenticator.field.info.on": "Conta protegida com código de segurança além da senha.", 8 | "authenticator.field.info.off": "A verificação em duas etapas aumenta a segurança da sua conta.
Uma vez ativada, você precisará usar sua senha e um código de 6 dígitos enviado para o seu celular para entrar.", 9 | "authenticator.turnOn.label": "Ativar verificação em duas etapas", 10 | "authenticator.turnOn.text": "Um aplicativo autenticador gera um código de segurança no seu celular. Caso você ainda não tenha um, instale-o agora no seu celular: {ios}, {android} ou {windows}.", 11 | "authenticator.turnOn.qrcode.label": "Para configurar seu aplicativo autenticador:", 12 | "authenticator.turnOn.qrcode.text": "- Vá em adicionar novo código baseado em tempo\n- Use seu aplicativo para escanear o código QR abaixo", 13 | "authenticator.turnOn.success": "A verificação em duas etapas foi ativada", 14 | "authenticator.turnOn.error": "Não foi possível ativar a verificação em duas etapas", 15 | "authenticator.turnOff.label": "Quer mesmo desativar a verificação em duas etapas?", 16 | "authenticator.turnOff.text": "Desativar a verificação em duas etapas removerá a camada extra de proteção e você precisará apenas da sua senha para entrar.", 17 | "authenticator.turnOff.success": "A verificação em duas etapas foi desativada", 18 | "authenticator.turnOff.error": "Não foi possível desativar a verificação em duas etapas", 19 | "authenticator.securityCode.confirmation.label": "Confirme seu código de segurança", 20 | "authenticator.securityCode.label": "Código de segurança", 21 | "authenticator.securityCode.error": "Código de segurança inválido ou expirado", 22 | "authenticator.securityCode.help": "Digite o código de segurança de 6 dígitos gerado pelo aplicativo autenticador no seu celular", 23 | "authenticator.backup.label": "Salve o código de backup", 24 | "authenticator.backup.text": "Você pode salvar um código de segurança para usar quando não tiver accesso ao aplicativo autenticador. Para isso, copie o código abaixo e armazene-o em local seguro.", 25 | "authenticator.backup.note": "Se por algum motivo você não conseguir acessar sua conta, contate o administrador do site.", 26 | "authenticator.backup.cancel": "Não, obrigado", 27 | "authenticator.backup.error": "Não foi possível salver seu código de backup", 28 | "authenticator.backupCode.label": "Código de backup", 29 | "authenticator.backupCode.error": "Código de backup inválido", 30 | "authenticator.backupCode.help": "Digite o código de backup criado quando você ativou a verificação em duas etapas" 31 | } 32 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Image/ImageBackEndInterface.php: -------------------------------------------------------------------------------- 1 | allowInsecureCallToGoogleApis) { 31 | throw new InsecureCallException('It\'s not secure to send secret keys to Google Apis, you have to explicitly allow it by calling $google2fa->setAllowInsecureCallToGoogleApis(true).'); 32 | } 33 | 34 | $url = $this->getQRCodeUrl($company, $holder, $secret); 35 | 36 | return Url::generateGoogleQRCodeUrl('https://chart.googleapis.com/', 'chart', 'chs='.$size.'x'.$size.'&chld=M|0&cht=qr&chl=', $url); 37 | } 38 | 39 | /** 40 | * Generates a QR code data url to display inline. 41 | * 42 | * @param string $company 43 | * @param string $holder 44 | * @param string $secret 45 | * @param int $size 46 | * @param string $encoding Default to UTF-8 47 | * 48 | * @return string 49 | */ 50 | public function getQRCodeInline($company, $holder, $secret, $size = 200, $encoding = 'utf-8') 51 | { 52 | $url = $this->getQRCodeUrl($company, $holder, $secret); 53 | 54 | $renderer = new Png(); 55 | $renderer->setWidth($size); 56 | $renderer->setHeight($size); 57 | 58 | $bacon = new BaconQrCodeWriter($renderer); 59 | $data = $bacon->writeString($url, $encoding); 60 | 61 | return 'data:image/png;base64,'.base64_encode($data); 62 | } 63 | 64 | /** 65 | * Creates a QR code url. 66 | * 67 | * @param $company 68 | * @param $holder 69 | * @param $secret 70 | * 71 | * @return string 72 | */ 73 | public function getQRCodeUrl($company, $holder, $secret) 74 | { 75 | return 'otpauth://totp/'.rawurlencode($company).':'.rawurlencode($holder).'?secret='.$secret.'&issuer='.rawurlencode($company).''; 76 | } 77 | 78 | /** 79 | * AllowInsecureCallToGoogleApis setter. 80 | * 81 | * @param mixed $allowInsecureCallToGoogleApis 82 | * 83 | * @return QRCode 84 | */ 85 | public function setAllowInsecureCallToGoogleApis($allowInsecureCallToGoogleApis) 86 | { 87 | $this->allowInsecureCallToGoogleApis = $allowInsecureCallToGoogleApis; 88 | 89 | return $this; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Renderer/Path/Path.php: -------------------------------------------------------------------------------- 1 | operations[] = new Move($x, $y); 26 | return $path; 27 | } 28 | 29 | /** 30 | * Draws a line from the current position to another position. 31 | */ 32 | public function line(float $x, float $y) : self 33 | { 34 | $path = clone $this; 35 | $path->operations[] = new Line($x, $y); 36 | return $path; 37 | } 38 | 39 | /** 40 | * Draws an elliptic arc from the current position to another position. 41 | */ 42 | public function ellipticArc( 43 | float $xRadius, 44 | float $yRadius, 45 | float $xAxisRotation, 46 | bool $largeArc, 47 | bool $sweep, 48 | float $x, 49 | float $y 50 | ) : self { 51 | $path = clone $this; 52 | $path->operations[] = new EllipticArc($xRadius, $yRadius, $xAxisRotation, $largeArc, $sweep, $x, $y); 53 | return $path; 54 | } 55 | 56 | /** 57 | * Draws a curve from the current position to another position. 58 | */ 59 | public function curve(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3) : self 60 | { 61 | $path = clone $this; 62 | $path->operations[] = new Curve($x1, $y1, $x2, $y2, $x3, $y3); 63 | return $path; 64 | } 65 | 66 | /** 67 | * Closes a sub-path. 68 | */ 69 | public function close() : self 70 | { 71 | $path = clone $this; 72 | $path->operations[] = Close::instance(); 73 | return $path; 74 | } 75 | 76 | /** 77 | * Appends another path to this one. 78 | */ 79 | public function append(self $other) : self 80 | { 81 | $path = clone $this; 82 | $path->operations = array_merge($this->operations, $other->operations); 83 | return $path; 84 | } 85 | 86 | public function translate(float $x, float $y) : self 87 | { 88 | $path = new self(); 89 | 90 | foreach ($this->operations as $operation) { 91 | $path->operations[] = $operation->translate($x, $y); 92 | } 93 | 94 | return $path; 95 | } 96 | 97 | /** 98 | * @return OperationInterface[]|Traversable 99 | */ 100 | public function getIterator() : Traversable 101 | { 102 | foreach ($this->operations as $operation) { 103 | yield $operation; 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/lib/cast_to_int.php: -------------------------------------------------------------------------------- 1 | operators might accidentally let a float 38 | * through. 39 | * 40 | * @param int|float $number The number we want to convert to an int 41 | * @param bool $fail_open Set to true to not throw an exception 42 | * 43 | * @return float|int 44 | * @psalm-suppress InvalidReturnType 45 | * 46 | * @throws TypeError 47 | */ 48 | function RandomCompat_intval($number, $fail_open = false) 49 | { 50 | if (is_int($number) || is_float($number)) { 51 | $number += 0; 52 | } elseif (is_numeric($number)) { 53 | /** @psalm-suppress InvalidOperand */ 54 | $number += 0; 55 | } 56 | /** @var int|float $number */ 57 | 58 | if ( 59 | is_float($number) 60 | && 61 | $number > ~PHP_INT_MAX 62 | && 63 | $number < PHP_INT_MAX 64 | ) { 65 | $number = (int) $number; 66 | } 67 | 68 | if (is_int($number)) { 69 | return (int) $number; 70 | } elseif (!$fail_open) { 71 | throw new TypeError( 72 | 'Expected an integer.' 73 | ); 74 | } 75 | return $number; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vendor/symfony/polyfill-util/TestListener.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Polyfill\Util; 13 | 14 | use PHPUnit\Framework\AssertionFailedError; 15 | use PHPUnit\Framework\TestListener as TestListenerInterface; 16 | use PHPUnit\Framework\Test; 17 | use PHPUnit\Framework\TestSuite; 18 | use PHPUnit\Framework\Warning; 19 | 20 | if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) { 21 | class_alias('Symfony\Polyfill\Util\LegacyTestListener', 'Symfony\Polyfill\Util\TestListener'); 22 | // Using an early return instead of a else does not work when using the PHPUnit phar due to some weird PHP behavior (the class 23 | // gets defined without executing the code before it and so the definition is not properly conditional) 24 | } else { 25 | /** 26 | * @author Nicolas Grekas 27 | */ 28 | class TestListener extends TestSuite implements TestListenerInterface 29 | { 30 | private $suite; 31 | private $trait; 32 | 33 | public function __construct(TestSuite $suite = null) 34 | { 35 | if ($suite) { 36 | $this->suite = $suite; 37 | $this->setName($suite->getName().' with polyfills enabled'); 38 | $this->addTest($suite); 39 | } 40 | $this->trait = new TestListenerTrait(); 41 | } 42 | 43 | public function startTestSuite(TestSuite $suite) 44 | { 45 | $this->trait->startTestSuite($suite); 46 | } 47 | 48 | protected function setUp() 49 | { 50 | TestListenerTrait::$enabledPolyfills = $this->suite->getName(); 51 | } 52 | 53 | protected function tearDown() 54 | { 55 | TestListenerTrait::$enabledPolyfills = false; 56 | } 57 | 58 | public function addError(Test $test, \Exception $e, $time) 59 | { 60 | $this->trait->addError($test, $e, $time); 61 | } 62 | 63 | public function addWarning(Test $test, Warning $e, $time) 64 | { 65 | } 66 | 67 | public function addFailure(Test $test, AssertionFailedError $e, $time) 68 | { 69 | $this->trait->addError($test, $e, $time); 70 | } 71 | 72 | public function addIncompleteTest(Test $test, \Exception $e, $time) 73 | { 74 | } 75 | 76 | public function addRiskyTest(Test $test, \Exception $e, $time) 77 | { 78 | } 79 | 80 | public function addSkippedTest(Test $test, \Exception $e, $time) 81 | { 82 | } 83 | 84 | public function endTestSuite(TestSuite $suite) 85 | { 86 | } 87 | 88 | public function startTest(Test $test) 89 | { 90 | } 91 | 92 | public function endTest(Test $test, $time) 93 | { 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php: -------------------------------------------------------------------------------- 1 | 0x2d && $src < 0x3a) ret += $src - 0x2e + 1; // -45 52 | $ret += (((0x2d - $src) & ($src - 0x3a)) >> 8) & ($src - 45); 53 | 54 | // if ($src > 0x40 && $src < 0x5b) ret += $src - 0x41 + 12 + 1; // -52 55 | $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 52); 56 | 57 | // if ($src > 0x60 && $src < 0x7b) ret += $src - 0x61 + 38 + 1; // -58 58 | $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 58); 59 | 60 | return $ret; 61 | } 62 | 63 | /** 64 | * Uses bitwise operators instead of table-lookups to turn 8-bit integers 65 | * into 6-bit integers. 66 | * 67 | * @param int $src 68 | * @return string 69 | */ 70 | protected static function encode6Bits(int $src): string 71 | { 72 | $src += 0x2e; 73 | 74 | // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 75 | $src += ((0x39 - $src) >> 8) & 7; 76 | 77 | // if ($src > 0x5a) $src += 0x61 - 0x5b; // 6 78 | $src += ((0x5a - $src) >> 8) & 6; 79 | 80 | return \pack('C', $src); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/README.md: -------------------------------------------------------------------------------- 1 | # Constant-Time Encoding 2 | 3 | [![Build Status](https://travis-ci.org/paragonie/constant_time_encoding.svg?branch=master)](https://travis-ci.org/paragonie/constant_time_encoding) 4 | [![Latest Stable Version](https://poser.pugx.org/paragonie/constant_time_encoding/v/stable)](https://packagist.org/packages/paragonie/constant_time_encoding) 5 | [![Latest Unstable Version](https://poser.pugx.org/paragonie/constant_time_encoding/v/unstable)](https://packagist.org/packages/paragonie/constant_time_encoding) 6 | [![License](https://poser.pugx.org/paragonie/constant_time_encoding/license)](https://packagist.org/packages/paragonie/constant_time_encoding) 7 | [![Downloads](https://img.shields.io/packagist/dt/paragonie/constant_time_encoding.svg)](https://packagist.org/packages/paragonie/constant_time_encoding) 8 | 9 | Based on the [constant-time base64 implementation made by Steve "Sc00bz" Thomas](https://github.com/Sc00bz/ConstTimeEncoding), 10 | this library aims to offer character encoding functions that do not leak 11 | information about what you are encoding/decoding via processor cache 12 | misses. Further reading on [cache-timing attacks](http://blog.ircmaxell.com/2014/11/its-all-about-time.html). 13 | 14 | Our fork offers the following enchancements: 15 | 16 | * `mbstring.func_overload` resistance 17 | * Unit tests 18 | * Composer- and Packagist-ready 19 | * Base16 encoding 20 | * Base32 encoding 21 | * Uses `pack()` and `unpack()` instead of `chr()` and `ord()` 22 | 23 | ## PHP Version Requirements 24 | 25 | Version 2 of this library should work on **PHP 7** or newer. For PHP 5 26 | support, see [the v1.x branch](https://github.com/paragonie/constant_time_encoding/tree/v1.x). 27 | 28 | If you are adding this as a dependency to a project intended to work on both PHP 5 and PHP 7, please set the required version to `^1|^2` instead of just `^1` or `^2`. 29 | 30 | ## How to Install 31 | 32 | ```sh 33 | composer require paragonie/constant_time_encoding 34 | ``` 35 | 36 | ## How to Use 37 | 38 | ```php 39 | use \ParagonIE\ConstantTime\Encoding; 40 | 41 | // possibly (if applicable): 42 | // require 'vendor/autoload.php'; 43 | 44 | $data = random_bytes(32); 45 | echo Encoding::base64Encode($data), "\n"; 46 | echo Encoding::base32EncodeUpper($data), "\n"; 47 | echo Encoding::base32Encode($data), "\n"; 48 | echo Encoding::hexEncode($data), "\n"; 49 | echo Encoding::hexEncodeUpper($data), "\n"; 50 | ``` 51 | 52 | Example output: 53 | 54 | ``` 55 | 1VilPkeVqirlPifk5scbzcTTbMT2clp+Zkyv9VFFasE= 56 | 2VMKKPSHSWVCVZJ6E7SONRY3ZXCNG3GE6ZZFU7TGJSX7KUKFNLAQ==== 57 | 2vmkkpshswvcvzj6e7sonry3zxcng3ge6zzfu7tgjsx7kukfnlaq==== 58 | d558a53e4795aa2ae53e27e4e6c71bcdc4d36cc4f6725a7e664caff551456ac1 59 | D558A53E4795AA2AE53E27E4E6C71BDCC4D36CC4F6725A7E664CAFF551456AC1 60 | ``` 61 | 62 | If you only need a particular variant, you can just reference the 63 | required class like so: 64 | 65 | ```php 66 | use \ParagonIE\ConstantTime\Base64; 67 | use \ParagonIE\ConstantTime\Base32; 68 | 69 | $data = random_bytes(32); 70 | echo Base64::encode($data), "\n"; 71 | echo Base32::encode($data), "\n"; 72 | ``` 73 | 74 | Example output: 75 | 76 | ``` 77 | 1VilPkeVqirlPifk5scbzcTTbMT2clp+Zkyv9VFFasE= 78 | 2vmkkpshswvcvzj6e7sonry3zxcng3ge6zzfu7tgjsx7kukfnlaq==== 79 | ``` 80 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php: -------------------------------------------------------------------------------- 1 | 2147483647) { 70 | for ($i = 0; $i < $bytes; $i += 1073741824) { 71 | $n = ($bytes - $i) > 1073741824 72 | ? 1073741824 73 | : $bytes - $i; 74 | $buf .= Sodium::randombytes_buf((int) $n); 75 | } 76 | } else { 77 | $buf .= Sodium::randombytes_buf((int) $bytes); 78 | } 79 | 80 | if (is_string($buf)) { 81 | if (RandomCompat_strlen($buf) === $bytes) { 82 | return $buf; 83 | } 84 | } 85 | 86 | /** 87 | * If we reach here, PHP has failed us. 88 | */ 89 | throw new Exception( 90 | 'Could not gather sufficient random data' 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/lib/random_bytes_libsodium.php: -------------------------------------------------------------------------------- 1 | 2147483647) { 66 | $buf = ''; 67 | for ($i = 0; $i < $bytes; $i += 1073741824) { 68 | $n = ($bytes - $i) > 1073741824 69 | ? 1073741824 70 | : $bytes - $i; 71 | $buf .= \Sodium\randombytes_buf($n); 72 | } 73 | } else { 74 | /** @var string|bool $buf */ 75 | $buf = \Sodium\randombytes_buf($bytes); 76 | } 77 | 78 | if (is_string($buf)) { 79 | if (RandomCompat_strlen($buf) === $bytes) { 80 | return $buf; 81 | } 82 | } 83 | 84 | /** 85 | * If we reach here, PHP has failed us. 86 | */ 87 | throw new Exception( 88 | 'Could not gather sufficient random data' 89 | ); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php: -------------------------------------------------------------------------------- 1 | GetRandom($bytes, 0)); 75 | if (RandomCompat_strlen($buf) >= $bytes) { 76 | /** 77 | * Return our random entropy buffer here: 78 | */ 79 | return (string) RandomCompat_substr($buf, 0, $bytes); 80 | } 81 | ++$execCount; 82 | } while ($execCount < $bytes); 83 | 84 | /** 85 | * If we reach here, PHP has failed us. 86 | */ 87 | throw new Exception( 88 | 'Could not gather sufficient random data' 89 | ); 90 | } 91 | } -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php: -------------------------------------------------------------------------------- 1 | 0x2d && $src < 0x30) ret += $src - 0x2e + 1; // -45 52 | $ret += (((0x2d - $src) & ($src - 0x30)) >> 8) & ($src - 45); 53 | 54 | // if ($src > 0x40 && $src < 0x5b) ret += $src - 0x41 + 2 + 1; // -62 55 | $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 62); 56 | 57 | // if ($src > 0x60 && $src < 0x7b) ret += $src - 0x61 + 28 + 1; // -68 58 | $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 68); 59 | 60 | // if ($src > 0x2f && $src < 0x3a) ret += $src - 0x30 + 54 + 1; // 7 61 | $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src + 7); 62 | 63 | return $ret; 64 | } 65 | 66 | /** 67 | * Uses bitwise operators instead of table-lookups to turn 8-bit integers 68 | * into 6-bit integers. 69 | * 70 | * @param int $src 71 | * @return string 72 | */ 73 | protected static function encode6Bits(int $src): string 74 | { 75 | $src += 0x2e; 76 | 77 | // if ($src > 0x2f) $src += 0x41 - 0x30; // 17 78 | $src += ((0x2f - $src) >> 8) & 17; 79 | 80 | // if ($src > 0x5a) $src += 0x61 - 0x5b; // 6 81 | $src += ((0x5a - $src) >> 8) & 6; 82 | 83 | // if ($src > 0x7a) $src += 0x30 - 0x7b; // -75 84 | $src -= ((0x7a - $src) >> 8) & 75; 85 | 86 | return \pack('C', $src); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Controllers/LoginController.php: -------------------------------------------------------------------------------- 1 | layout('base', [ 19 | 'content' => $this->view('auth/error', [ 20 | 'error' => $e->getMessage() 21 | ]) 22 | ]); 23 | } 24 | 25 | if ($login->isAuthenticated()) { 26 | $this->redirect(); 27 | } 28 | 29 | if ($login->isBlocked()) { 30 | return $this->layout('base', [ 31 | 'content' => $this->view('auth/block') 32 | ]); 33 | } 34 | 35 | $attempts = $this->logData('sc_attempts'); 36 | $canUseBackupCode = $attempts && $attempts >= 3; 37 | 38 | $self = $this; 39 | $form = $this->form('auth/login', compact('canUseBackupCode'), function ($form) use ($self, $login, $canUseBackupCode) { 40 | $data = $form->serialize(); 41 | $backupCodeWasUsed = false; 42 | 43 | try { 44 | if ($canUseBackupCode) { 45 | $backupCodeWasUsed = $self->validateBackupCode($data); 46 | } else { 47 | $self->validateUserSecret($data['security_code'], $data['username']); 48 | } 49 | 50 | $login->attempt($data['username'], $data['password']); 51 | 52 | if ($backupCodeWasUsed) { 53 | $self->alert(l('authenticator.turnOff.success')); 54 | $self->redirect('users/' . site()->user()->username . '/edit'); 55 | } 56 | 57 | $self->redirect(); 58 | } catch (Exception $e) { 59 | if ($e instanceof InvalidOrExpiredCode) { 60 | $form->alert($e->getMessage()); 61 | $form->fields->security_code->error = true; 62 | $self->logAttempt(); 63 | } elseif ($e instanceof InvalidBackupCode) { 64 | $form->alert($e->getMessage()); 65 | $form->fields->backup_code->error = true; 66 | } else { 67 | $form->alert(l('login.error')); 68 | $form->fields->username->error = true; 69 | $form->fields->password->error = true; 70 | } 71 | } 72 | }); 73 | 74 | return $this->layout('base', [ 75 | 'bodyclass' => 'login', 76 | 'content' => $this->view('auth/login', compact('form')) 77 | ]); 78 | } 79 | 80 | public function logout() 81 | { 82 | if ($user = panel()->user()) { 83 | $user->logout(); 84 | } 85 | 86 | $this->redirect('login'); 87 | } 88 | 89 | public function logAttempt() 90 | { 91 | $data = $this->logData(); 92 | 93 | $data['sc_attempts'] = isset($data['sc_attempts']) 94 | ? $data['sc_attempts'] + 1 95 | : 1; 96 | 97 | $this->log($data); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /vendor/bacon/bacon-qr-code/src/Encoder/QrCode.php: -------------------------------------------------------------------------------- 1 | mode = $mode; 63 | $this->errorCorrectionLevel = $errorCorrectionLevel; 64 | $this->version = $version; 65 | $this->maskPattern = $maskPattern; 66 | $this->matrix = $matrix; 67 | } 68 | 69 | /** 70 | * Gets the mode. 71 | */ 72 | public function getMode() : Mode 73 | { 74 | return $this->mode; 75 | } 76 | 77 | /** 78 | * Gets the EC level. 79 | */ 80 | public function getErrorCorrectionLevel() : ErrorCorrectionLevel 81 | { 82 | return $this->errorCorrectionLevel; 83 | } 84 | 85 | /** 86 | * Gets the version. 87 | */ 88 | public function getVersion() : Version 89 | { 90 | return $this->version; 91 | } 92 | 93 | /** 94 | * Gets the mask pattern. 95 | */ 96 | public function getMaskPattern() : int 97 | { 98 | return $this->maskPattern; 99 | } 100 | 101 | /** 102 | * Gets the matrix. 103 | * 104 | * @return ByteMatrix 105 | */ 106 | public function getMatrix() 107 | { 108 | return $this->matrix; 109 | } 110 | 111 | /** 112 | * Validates whether a mask pattern is valid. 113 | */ 114 | public static function isValidMaskPattern(int $maskPattern) : bool 115 | { 116 | return $maskPattern > 0 && $maskPattern < self::NUM_MASK_PATTERNS; 117 | } 118 | 119 | /** 120 | * Returns a string representation of the QR code. 121 | */ 122 | public function __toString() : string 123 | { 124 | $result = "<<\n" 125 | . ' mode: ' . $this->mode . "\n" 126 | . ' ecLevel: ' . $this->errorCorrectionLevel . "\n" 127 | . ' version: ' . $this->version . "\n" 128 | . ' maskPattern: ' . $this->maskPattern . "\n"; 129 | 130 | if ($this->matrix === null) { 131 | $result .= " matrix: null\n"; 132 | } else { 133 | $result .= " matrix:\n"; 134 | $result .= $this->matrix; 135 | } 136 | 137 | $result .= ">>\n"; 138 | 139 | return $result; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php: -------------------------------------------------------------------------------- 1 | 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64 53 | $ret += (((0x40 - $src) & ($src - 0x5b)) >> 8) & ($src - 64); 54 | 55 | // if ($src > 0x60 && $src < 0x7b) $ret += $src - 0x61 + 26 + 1; // -70 56 | $ret += (((0x60 - $src) & ($src - 0x7b)) >> 8) & ($src - 70); 57 | 58 | // if ($src > 0x2f && $src < 0x3a) $ret += $src - 0x30 + 52 + 1; // 5 59 | $ret += (((0x2f - $src) & ($src - 0x3a)) >> 8) & ($src + 5); 60 | 61 | // if ($src == 0x2c) $ret += 62 + 1; 62 | $ret += (((0x2c - $src) & ($src - 0x2e)) >> 8) & 63; 63 | 64 | // if ($src == 0x5f) ret += 63 + 1; 65 | $ret += (((0x5e - $src) & ($src - 0x60)) >> 8) & 64; 66 | 67 | return $ret; 68 | } 69 | 70 | /** 71 | * Uses bitwise operators instead of table-lookups to turn 8-bit integers 72 | * into 6-bit integers. 73 | * 74 | * @param int $src 75 | * @return string 76 | */ 77 | protected static function encode6Bits(int $src): string 78 | { 79 | $diff = 0x41; 80 | 81 | // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6 82 | $diff += ((25 - $src) >> 8) & 6; 83 | 84 | // if ($src > 51) $diff += 0x30 - 0x61 - 26; // -75 85 | $diff -= ((51 - $src) >> 8) & 75; 86 | 87 | // if ($src > 61) $diff += 0x2d - 0x30 - 10; // -13 88 | $diff -= ((61 - $src) >> 8) & 13; 89 | 90 | // if ($src > 62) $diff += 0x5f - 0x2b - 1; // 3 91 | $diff += ((62 - $src) >> 8) & 49; 92 | 93 | return \pack('C', $src + $diff); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /vendor/pragmarx/google2fa/src/Support/Base32.php: -------------------------------------------------------------------------------- 1 | toBase32($prefix) : ''; 26 | 27 | $secret = $this->strPadBase32($secret, $length); 28 | 29 | $this->validateSecret($secret); 30 | 31 | return $secret; 32 | } 33 | 34 | /** 35 | * Decodes a base32 string into a binary string. 36 | * 37 | * @param string $b32 38 | * 39 | * @throws InvalidCharactersException 40 | * 41 | * @return int 42 | */ 43 | public function base32Decode($b32) 44 | { 45 | $b32 = strtoupper($b32); 46 | 47 | $this->validateSecret($b32); 48 | 49 | return ParagonieBase32::decodeUpper($b32); 50 | } 51 | 52 | /** 53 | * Pad string with random base 32 chars. 54 | * 55 | * @param $string 56 | * @param $length 57 | * 58 | * @return string 59 | */ 60 | private function strPadBase32($string, $length) 61 | { 62 | for ($i = 0; $i < $length; $i++) { 63 | $string .= substr(Constants::VALID_FOR_B32_SCRAMBLED, $this->getRandomNumber(), 1); 64 | } 65 | 66 | return $string; 67 | } 68 | 69 | /** 70 | * Encode a string to Base32. 71 | * 72 | * @param $string 73 | * 74 | * @return mixed 75 | */ 76 | public function toBase32($string) 77 | { 78 | $encoded = ParagonieBase32::encodeUpper($string); 79 | 80 | return str_replace('=', '', $encoded); 81 | } 82 | 83 | /** 84 | * Get a random number. 85 | * 86 | * @param $from 87 | * @param $to 88 | * 89 | * @return int 90 | */ 91 | protected function getRandomNumber($from = 0, $to = 31) 92 | { 93 | return random_int($from, $to); 94 | } 95 | 96 | /** 97 | * Validate the secret. 98 | * 99 | * @param $b32 100 | */ 101 | protected function validateSecret($b32) 102 | { 103 | $this->checkForValidCharacters($b32); 104 | 105 | $this->checkGoogleAuthenticatorCompatibility($b32); 106 | } 107 | 108 | /** 109 | * Check if the secret key is compatible with Google Authenticator. 110 | * 111 | * @param $b32 112 | * 113 | * @throws IncompatibleWithGoogleAuthenticatorException 114 | */ 115 | protected function checkGoogleAuthenticatorCompatibility($b32) 116 | { 117 | if ($this->enforceGoogleAuthenticatorCompatibility && ((strlen($b32) & (strlen($b32) - 1)) !== 0)) { 118 | throw new IncompatibleWithGoogleAuthenticatorException(); 119 | } 120 | } 121 | 122 | /** 123 | * Check if all secret key characters are valid. 124 | * 125 | * @param $b32 126 | * 127 | * @throws InvalidCharactersException 128 | */ 129 | protected function checkForValidCharacters($b32) 130 | { 131 | if (preg_replace('/[^'.Constants::VALID_FOR_B32.']/', '', $b32) !== $b32) { 132 | throw new InvalidCharactersException(); 133 | } 134 | } 135 | } 136 | --------------------------------------------------------------------------------