diff --git a/composer.json b/composer.json index 5afa5a4..cb5f10a 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,8 @@ "mirzaev/vk": "^5.0", "triagens/arangodb": "~3.9.x-dev", "twig/twig": "^3.4", - "guzzlehttp/guzzle": "^7.5" + "guzzlehttp/guzzle": "^7.5", + "scripturadesign/markov": "^2.0" }, "require-dev": { "phpunit/phpunit": "~9.5" diff --git a/composer.lock b/composer.lock index 1ceac43..b2c1f6f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b562666ddbd12600f288a2949acc97d4", + "content-hash": "c0621deb07173185d918fd02e7551ca4", "packages": [ { "name": "guzzlehttp/guzzle", @@ -396,13 +396,13 @@ "source": { "type": "git", "url": "https://git.mirzaev.sexy/mirzaev/accounts", - "reference": "4d6df00dc9538c99d8eced6deebab55f1af2bf8a" + "reference": "aa93c4d26395025fa16bb65e8a40332ac352a742" }, "require": { - "ext-dom": "20031129", - "ext-libxml": "~8.1.1", - "guzzlehttp/guzzle": "^7.2", - "php": "~8.1" + "ext-dom": "*", + "ext-libxml": "*", + "guzzlehttp/guzzle": "^7.5", + "php": "~8.2" }, "require-dev": { "phpdocumentor/phpdocumentor": ">=2.9", @@ -442,7 +442,7 @@ "type": "funding" } ], - "time": "2022-11-05T23:48:10+00:00" + "time": "2023-02-17T08:36:36+00:00" }, { "name": "mirzaev/arangodb", @@ -932,17 +932,68 @@ "time": "2019-03-08T08:55:37+00:00" }, { - "name": "symfony/deprecation-contracts", - "version": "v3.1.1", + "name": "scripturadesign/markov", + "version": "v2.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" + "url": "https://github.com/scripturadesign/markov.git", + "reference": "ca6d51a5d8ce1e115708c2d38c49c397e515cae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", - "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", + "url": "https://api.github.com/repos/scripturadesign/markov/zipball/ca6d51a5d8ce1e115708c2d38c49c397e515cae9", + "reference": "ca6d51a5d8ce1e115708c2d38c49c397e515cae9", + "shasum": "" + }, + "require": { + "php": "^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.4.0", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.15.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Scriptura\\Markov\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Martin Dilling-Hansen", + "email": "martindilling@gmail.com", + "homepage": "http://martindilling.com", + "role": "Developer" + } + ], + "description": "Markov Chain", + "homepage": "https://github.com/scripturadesign/markov", + "keywords": [ + "markov chain" + ], + "support": { + "issues": "https://github.com/scripturadesign/markov/issues", + "source": "https://github.com/scripturadesign/markov/tree/v2.0.0" + }, + "time": "2021-12-15T00:09:01+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "0121954c80fd17c18cf050fe73360e63bb43d4fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0121954c80fd17c18cf050fe73360e63bb43d4fb", + "reference": "0121954c80fd17c18cf050fe73360e63bb43d4fb", "shasum": "" }, "require": { @@ -951,7 +1002,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -980,7 +1031,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -996,7 +1047,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T11:15:52+00:00" + "time": "2023-02-02T07:48:03+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1226,16 +1277,16 @@ }, { "name": "twig/twig", - "version": "v3.4.3", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58" + "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58", - "reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6e0510cc793912b451fd40ab983a1d28f611c15", + "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15", "shasum": "" }, "require": { @@ -1250,7 +1301,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "3.5-dev" } }, "autoload": { @@ -1286,7 +1337,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.4.3" + "source": "https://github.com/twigphp/Twig/tree/v3.5.1" }, "funding": [ { @@ -1298,36 +1349,36 @@ "type": "tidelift" } ], - "time": "2022-09-28T08:42:51+00:00" + "time": "2023-02-08T07:49:20+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -1354,7 +1405,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -1370,7 +1421,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "myclabs/deep-copy", @@ -1433,16 +1484,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -1483,9 +1534,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "phar-io/manifest", @@ -1600,23 +1651,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.19", + "version": "9.2.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" + "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954", + "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1665,7 +1716,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25" }, "funding": [ { @@ -1673,7 +1724,7 @@ "type": "github" } ], - "time": "2022-11-18T07:47:47+00:00" + "time": "2023-02-25T05:32:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1918,20 +1969,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.26", + "version": "9.6.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" + "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", + "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -1969,7 +2020,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -2000,7 +2051,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" }, "funding": [ { @@ -2016,7 +2067,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T06:00:21+00:00" + "time": "2023-02-27T13:06:37+00:00" }, { "name": "sebastian/cli-parser", @@ -2384,16 +2435,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -2435,7 +2486,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -2443,7 +2494,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -2757,16 +2808,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -2805,10 +2856,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -2816,7 +2867,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -2875,16 +2926,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -2919,7 +2970,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -2927,7 +2978,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -3043,8 +3094,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.1", - "ext-sodium": "~8.1" + "php": "~8.2", + "ext-sodium": "~8.2" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git "a/mirzaev/site/account/system/\\" "b/mirzaev/site/account/system/\\" new file mode 100644 index 0000000..369117c --- /dev/null +++ "b/mirzaev/site/account/system/\\" @@ -0,0 +1,74 @@ + + */ +final class api extends core +{ + /** + * Проверить существование + * + * @param array $parameters Параметры запроса + * + * @return string JSON с параметром exist + */ + public function invite_verify(array $parameters = []): string + { + // Инициализация буфера ответа + $return = ['errors' => &$this->errors]; + + // Запрос проверки на существование приглашения + $invite = invite::read($parameters['key'], $this->errors['account']); + + $return['exist'] = isset($invite); + + if ($parameters['from'] == 1) $return['from'] = ['login' => 'mirzaev'] ?? $invite->from(); + + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode($return); + } + + /** + * Сгенерировать классический пароль + * + * @param array $parameters Параметры запроса + * + * @return string JSON с параметром password + */ + public function password_classic(array $parameters = []): string + { + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode(['password' => password::classic((int) $parameters['length'], $this->errors), 'errors' => $this->errors]); + } + + /** + * Сгенерировать мнемонический пароль + * + * @param array $parameters Параметры запроса + * + * @return string JSON с параметром password + */ + public function password_mnemonic(array $parameters = []): string + { + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode(['password' => password::mnemonic((int) $parameters['length'], $this->errors), 'errors' => $this->errors]); + } +} diff --git a/mirzaev/site/account/system/controllers/account.php b/mirzaev/site/account/system/controllers/account.php new file mode 100644 index 0000000..e9385bb --- /dev/null +++ b/mirzaev/site/account/system/controllers/account.php @@ -0,0 +1,149 @@ + + */ +final class account extends core +{ + /** + * Страница профиля + * + * @param array $parameters Параметры запроса + */ + public function index(array $parameters = []): ?string + { + return null; + } + + /** + * Инициализация + * + * @param array $parameters Параметры запроса + */ + public function initialization(array $parameters = []): ?string + { + if ($this->variables['account'] instanceof _document) { + // Найден аккаунт + + if ($this->variables['vk'] instanceof _document) { + // Найден аккаунт ВКонтакте + + // Инициализация данных аккаунта ВКонтакте + vk::parse($this->variables['vk'], $this->variables['errors']['vk']); + } + + // Запись кода ответа + http_response_code(200); + + return null; + } else { + // Не найден аккаунт + + // Запись кода ответа + http_response_code(401); + + // Запись заголовка ответа с ключом аккаунта + header('session: ' . $this->variables['session']->hash); + + return null; + } + + // Запись кода ответа + http_response_code(500); + + return null; + } + + /** + * Связь аккаунта с аккаунтом ВКонтакте + * + * @param array $parameters Параметры запроса + */ + public function connect(array $parameters = []): ?string + { + if ($this->variables['session']->hash === $parameters['state']) { + // Совпадает хеш сессии с полученным хешем из ответа ВКонтакте + + if (!empty($response = vk::key($parameters['code'], $this->variables['errors']['vk']))) { + // Получены данные аккаунта ВКонтакте + + if (($this->variables['vk'] = vk::initialization($response, $this->variables['errors']['vk'])) instanceof _document) { + // Инициализирован аккаунт ВКонтакте + + if (($this->variables['account'] = vk::account($this->variables['vk'])) instanceof _document) { + // Найден аккаунт (существующий) + + if (session::connect($this->variables['session'], $this->variables['account'], $this->variables['errors']['session'])) { + // Связана сессия с аккаунтом + } + } else if (($this->variables['account'] = model::create($this->variables['errors']['account'])) instanceof _document) { + // Найден аккаунт (создан новый) + + if (session::connect($this->variables['session'], $this->variables['account'], $this->variables['errors']['session'])) { + // Связана сессия с аккаунтом + + if (account::connect($this->variables['account'], $this->variables['vk'], $this->variables['errors']['account'])) { + // Связан аккаунт с аккаунтом ВКонтакте + } + } + } + + // Инициализация робота для аккаунта ВКонтакте + $this->vk = api::init()->user(key: $this->variables['vk']->access['key']); + + if ($this->variables['vk'] instanceof _document) { + // Инициализирован робот для аккаунта ВКонтакте + + // Инициализация данных аккаунта ВКонтакте + $data = vk::parse($this->vk, $this->variables['errors']['vk']); + var_dump($data); + die; + + if ($data instanceof stdClass) { + // Получены данные ВКонтакте + + // Запись в базу данных + vk::update($this->variables['vk'], $data, $this->variables['errors']['vk']); + } + } + } + } + } + + // Генерация представления + return $this->view->render(DIRECTORY_SEPARATOR . 'account' . DIRECTORY_SEPARATOR . 'vk.html', $this->variables); + } + + /** + * Генерация панели аккаунта + * + * @param array $parameters Параметры запроса + */ + public function panel(array $parameters = []): ?string + { + // Генерация представления + return $this->view->render(DIRECTORY_SEPARATOR . 'account' . DIRECTORY_SEPARATOR . 'panel.html', $this->variables); + } +} diff --git a/mirzaev/site/account/system/controllers/account_controller.php b/mirzaev/site/account/system/controllers/account_controller.php deleted file mode 100644 index d4e0ff9..0000000 --- a/mirzaev/site/account/system/controllers/account_controller.php +++ /dev/null @@ -1,146 +0,0 @@ - - */ -final class account_controller extends core -{ - /** - * Страница профиля - * - * @param array $parameters Параметры запроса - */ - public function index(array $parameters = []): ?string - { - return null; - } - - /** - * Инициализация - * - * @param array $parameters Параметры запроса - */ - public function initialization(array $parameters = []): ?string - { - if ($this->variables['account'] instanceof _document) { - // Найден аккаунт - - if ($this->variables['vk'] instanceof _document) { - // Найден аккаунт ВКонтакте - - // Инициализация данных аккаунта ВКонтакте - vk::parse($this->variables['vk'], $this->variables['errors']['vk']); - } - - // Запись кода ответа - http_response_code(200); - - return null; - } else { - // Не найден аккаунт - - // Запись кода ответа - http_response_code(401); - - // Запись заголовка ответа с ключом аккаунта - header('session: ' . $this->variables['session']->hash); - - return null; - } - - // Запись кода ответа - http_response_code(500); - - return null; - } - - /** - * Связь аккаунта с аккаунтом ВКонтакте - * - * @param array $parameters Параметры запроса - */ - public function connect(array $parameters = []): ?string - { - if ($this->variables['session']->hash === $parameters['state']) { - // Совпадает хеш сессии с полученным хешем из ответа ВКонтакте - - if (!empty($response = vk::key($parameters['code'], $this->variables['errors']['vk']))) { - // Получены данные аккаунта ВКонтакте - - if (($this->variables['vk'] = vk::initialization($response, $this->variables['errors']['vk'])) instanceof _document) { - // Инициализирован аккаунт ВКонтакте - - if (($this->variables['account'] = vk::account($this->variables['vk'])) instanceof _document) { - // Найден аккаунт (существующий) - - if (session::connect($this->variables['session'], $this->variables['account'], $this->variables['errors']['session'])) { - // Связана сессия с аккаунтом - } - } else if (($this->variables['account'] = account::create($this->variables['errors']['account'])) instanceof _document) { - // Найден аккаунт (создан новый) - - if (session::connect($this->variables['session'], $this->variables['account'], $this->variables['errors']['session'])) { - // Связана сессия с аккаунтом - - if (account::connect($this->variables['account'], $this->variables['vk'], $this->variables['errors']['account'])) { - // Связан аккаунт с аккаунтом ВКонтакте - } - } - } - - // Инициализация робота для аккаунта ВКонтакте - $this->vk = api::init()->user(key: $this->variables['vk']->access['key']); - - if ($this->variables['vk'] instanceof _document) { - // Инициализирован робот для аккаунта ВКонтакте - - // Инициализация данных аккаунта ВКонтакте - $data = vk::parse($this->vk, $this->variables['errors']['vk']); - var_dump($data); die; - - if ($data instanceof stdClass) { - // Получены данные ВКонтакте - - // Запись в базу данных - vk::update($this->variables['vk'], $data, $this->variables['errors']['vk']); - } - } - } - } - } - - // Генерация представления - return $this->view->render(DIRECTORY_SEPARATOR . 'account' . DIRECTORY_SEPARATOR . 'vk.html', $this->variables); - } - - /** - * Генерация панели аккаунта - * - * @param array $parameters Параметры запроса - */ - public function panel(array $parameters = []): ?string - { - // Генерация представления - return $this->view->render(DIRECTORY_SEPARATOR . 'account' . DIRECTORY_SEPARATOR . 'panel.html', $this->variables); - } -} diff --git a/mirzaev/site/account/system/controllers/api.php b/mirzaev/site/account/system/controllers/api.php new file mode 100644 index 0000000..0760a33 --- /dev/null +++ b/mirzaev/site/account/system/controllers/api.php @@ -0,0 +1,73 @@ + + */ +final class api extends core +{ + use errors; + + /** + * Сгенерировать пароль + * + * @param array $parameters Параметры запроса + * + * @return string JSON-документ с запрашиваемыми параметрами + */ + public function password(array $parameters = []): string + { + // Инициализация буфера ответа + $buffer = []; + + // Инициализация реестра возвращаемых параметров + $return = explode(',', $parameters['return'], 50); + + // Инициализация значений по умолчению + $parameters['length'] ??= 6; + $parameters['type'] ??= 'classic'; + + try { + // Проверка параметров на соответствие требованиям + if (($parameters['length'] = (int) $parameters['length']) === 0) throw new exception('Минимальная длина генерируемого пароля: 1 символ'); + if ($parameters['type'] !== 'classic' && $parameters['type'] !== 'mnemonic') throw new exception('Допустимые типы пароля: "mnemonic", "classic"'); + + // Генерация ответа по запрашиваемым параметрам + foreach ($return as $parameter) match ($parameter) { + 'password' => $buffer['password'] = password::{$parameters['type'] ?? 'classic'}($parameters['length'], $this->errors), + 'errors' => null, + default => throw new exception("Параметр не найден: $parameter") + }; + } catch (exception $e) { + // Запись в журнал ошибок + $this->errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + // Запись реестра ошибок в буфер ответа + if (in_array('errors', $return, true)) $buffer['errors'] = self::parse_only_text($this->errors); + + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode($buffer); + } +} diff --git a/mirzaev/site/account/system/controllers/core.php b/mirzaev/site/account/system/controllers/core.php index 334e8d7..da52236 100644 --- a/mirzaev/site/account/system/controllers/core.php +++ b/mirzaev/site/account/system/controllers/core.php @@ -7,8 +7,8 @@ namespace mirzaev\site\account\controllers; // Файлы проекта use mirzaev\site\account\views\templater; use mirzaev\site\account\models\core as models; -use mirzaev\site\account\models\account_model as account; -use mirzaev\site\account\models\session_model as session; +use mirzaev\site\account\models\account; +use mirzaev\site\account\models\session; // Библиотека для ArangoDB use ArangoDBClient\Document as _document; @@ -26,13 +26,36 @@ use mirzaev\vk\robots\user as robot; * @package mirzaev\site\account\controllers * @author Arsen Mirzaev Tatyano-Muradovich */ -class core extends controller +class core extends controller { /** * Переменные окружения */ protected robot $vk; + /** + * Инстанция сессии + */ + public session $session; + + /** + * Инстанция аккаунта + */ + public ?account $account; + + /** + * Постфикс + */ + public string $postfix = ''; + + /** + * Реестр ошибок + */ + public array $errors = [ + 'session' => [], + 'account' => [] + ]; + /** * Конструктор * @@ -48,25 +71,18 @@ class core extends controller // Инициализация шаблонизатора представлений $this->view = new templater; - // Инициализация журнала ошибок - $this->view->errors = [ - 'session' => [], - 'account' => [], - 'vk' => [] - ]; - // Инициализация даты до которой будет активна сессия $expires = time() + 604800; // Инициализация сессии (без журналирования) - $this->view->session = new session($_COOKIE["session"] ?? null, $expires) ?? + $this->session = new session($_COOKIE["session"] ?? null, $expires) ?? header('Location: https://mirzaev.sexy/error?code=500&text=Не+удалось+инициализировать+сессию'); - if ($_COOKIE["session"] ?? null !== $this->view->session->hash) { + if ($_COOKIE["session"] ?? null !== $this->session->hash) { // Изменился хеш сессии (подразумевается, что сессия устарела) // Запись хеша новой сессии - setcookie('session', $this->view->session->hash, [ + setcookie('session', $this->session->hash, [ 'expires' => $expires, 'domain' => 'mirzaev.sexy', 'path' => '/', @@ -77,20 +93,11 @@ class core extends controller } // Инициализация аккаунта (без журналирования) - $this->view->account = $this->view->session->account(); + $this->account = $this->session->account(); - if ($this->view->account instanceof _document) { + if ($this->account instanceof _document) { // Инициализирован аккаунт - // Инициализация аккаунта ВКонтакте (без журналирования) - $this->variables['vk'] = account::vk($this->variables['account']); - - if ($this->variables['vk'] instanceof _document) { - // Инициализирован аккаунт ВКонтакте - - // Инициализация робота для аккаунта ВКонтакте - $this->vk = vk::init()->user(key: $this->variables['vk']->access['key']); - } else unset($this->variables['account'], $this->variables['vk']); } } } diff --git a/mirzaev/site/account/system/controllers/error_controller.php b/mirzaev/site/account/system/controllers/error.php similarity index 79% rename from mirzaev/site/account/system/controllers/error_controller.php rename to mirzaev/site/account/system/controllers/error.php index 188279a..53e8503 100644 --- a/mirzaev/site/account/system/controllers/error_controller.php +++ b/mirzaev/site/account/system/controllers/error.php @@ -13,7 +13,7 @@ use mirzaev\site\account\controllers\core; * @package mirzaev\site\account\controllers * @author Arsen Mirzaev Tatyano-Muradovich */ -final class error_controller extends core +final class error extends core { /** * Страница с ошибкой @@ -23,22 +23,22 @@ final class error_controller extends core public function index(array $parameters = []): ?string { // Запись текста ошибки в переменную окружения - $this->variables['text'] = $parameters['text'] ?? null; + $this->view->text = $parameters['text'] ?? null; if (isset($parameters['code'])) { // Получен код ошибки // Запись кода ошибки в переменную окружения - $this->variables['code'] = $parameters['code']; + $this->view->code = $parameters['code']; // Запись кода ответа http_response_code($parameters['code']); // Генерация представления - return $this->view->render(DIRECTORY_SEPARATOR . 'errors' . DIRECTORY_SEPARATOR . 'index.html', $this->variables); + return $this->view->render(DIRECTORY_SEPARATOR . 'errors' . DIRECTORY_SEPARATOR . 'index.html'); } // Генерация представления - return $this->view->render(DIRECTORY_SEPARATOR . 'errors' . DIRECTORY_SEPARATOR . ($parameters['code'] ?? 'index') . '.html', $this->variables); + return $this->view->render(DIRECTORY_SEPARATOR . 'errors' . DIRECTORY_SEPARATOR . ($parameters['code'] ?? 'index') . '.html'); } } diff --git a/mirzaev/site/account/system/controllers/graph_controller.php b/mirzaev/site/account/system/controllers/graph.php similarity index 94% rename from mirzaev/site/account/system/controllers/graph_controller.php rename to mirzaev/site/account/system/controllers/graph.php index 02e5d73..16a7307 100644 --- a/mirzaev/site/account/system/controllers/graph_controller.php +++ b/mirzaev/site/account/system/controllers/graph.php @@ -13,7 +13,7 @@ use mirzaev\site\account\controllers\core; * @package mirzaev\site\account\controllers * @author Arsen Mirzaev Tatyano-Muradovich */ -final class graph_controller extends core +final class graph extends core { /** * Страница с графиком diff --git a/mirzaev/site/account/system/controllers/hotline_controller.php b/mirzaev/site/account/system/controllers/hotline.php similarity index 95% rename from mirzaev/site/account/system/controllers/hotline_controller.php rename to mirzaev/site/account/system/controllers/hotline.php index 72696d2..1e52792 100644 --- a/mirzaev/site/account/system/controllers/hotline_controller.php +++ b/mirzaev/site/account/system/controllers/hotline.php @@ -13,7 +13,7 @@ use mirzaev\site\account\controllers\core; * @package mirzaev\site\account\controllers * @author Arsen Mirzaev Tatyano-Muradovich */ -final class hotline_controller extends core +final class hotline extends core { /** * Страница с бегущей строкой diff --git a/mirzaev/site/account/system/controllers/index_controller.php b/mirzaev/site/account/system/controllers/index.php similarity index 79% rename from mirzaev/site/account/system/controllers/index_controller.php rename to mirzaev/site/account/system/controllers/index.php index 4365119..f17bcf3 100644 --- a/mirzaev/site/account/system/controllers/index_controller.php +++ b/mirzaev/site/account/system/controllers/index.php @@ -13,7 +13,7 @@ use mirzaev\site\account\controllers\core; * @package mirzaev\site\account\controllers * @author Arsen Mirzaev Tatyano-Muradovich */ -final class index_controller extends core +final class index extends core { /** * Главная страница @@ -25,6 +25,7 @@ final class index_controller extends core // Инициализация узлов $this->view->nodes = [ 'account' => $this->view->render(DIRECTORY_SEPARATOR . 'nodes' . DIRECTORY_SEPARATOR . (isset($this->account) ? 'profile.html' : 'authentication.html')) + /* 'account' => $this->view->render(DIRECTORY_SEPARATOR . 'nodes' . DIRECTORY_SEPARATOR . (isset($this->account) ? 'profile.html' : 'connect.html')) */ ]; // Генерация представления diff --git a/mirzaev/site/account/system/controllers/session.php b/mirzaev/site/account/system/controllers/session.php new file mode 100644 index 0000000..8e99af6 --- /dev/null +++ b/mirzaev/site/account/system/controllers/session.php @@ -0,0 +1,203 @@ + + */ +final class session extends core +{ + use errors; + + /** + * Записать входной псевдоним + * + * Проверяет существование аккаунта с этим входным псевдонимом + * и запоминает для использования в процессе аутентификации + * + * @param array $parameters Параметры запроса + * + * @return string JSON-документ с запрашиваемыми параметрами + */ + public function login(array $parameters = []): string + { + // Инициализация буфера ответа + $buffer = []; + + // Инициализация реестра возвращаемых параметров + $return = explode(',', $parameters['return'], 50); + + try { + // Проверка наличия обязательных параметров + if (empty($parameters['login'])) throw new exception('Необходимо передать входной псевдоним'); + + // Вычисление длины + $length = strlen($parameters['login']); + + // Проверка параметров на соответствование требованиям + if ($length === 0) throw new exception('Входной псевдоним не может быть пустым'); + if ($length > 100) throw new exception('Входной псевдоним не может быть длиннее 100 символов'); + + // Поиск аккаунта + $account = account::read($parameters['login'], $this->errors['account']); + + // Генерация ответа по запрашиваемым параметрам + foreach ($return as $parameter) match ($parameter) { + 'exist' => $buffer['exist'] = isset($account->instance), + 'errors' => null, + default => throw new exception("Параметр не найден: $parameter") + }; + + if ($parameters['remember'] === '1') $this->session->remember('account.identification.login', $parameters['login']); + } catch (exception $e) { + // Запись в журнал ошибок + $this->errors['session'][] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + // Запись реестра ошибок в буфер ответа + if (in_array('errors', $return, true)) $buffer['errors'] = self::parse_only_text($this->errors); + + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode($buffer); + } + + /** + * Записать пароль + * + * Проверяет на соответствие требованиям + * и запоминает для использования в процессе аутентификации + * + * @param array $parameters Параметры запроса + * + * @return string JSON-документ с запрашиваемыми параметрами + */ + public function password(array $parameters = []): string + { + // Инициализация буфера ответа + $buffer = []; + + // Инициализация реестра возвращаемых параметров + $return = explode(',', $parameters['return'], 50); + + try { + // Проверка наличия обязательных параметров + if (empty($parameters['password'])) throw new exception('Необходимо передать пароль'); + + // Вычисление длины + $length = strlen($parameters['password']); + + // Проверка параметров на соответствование требованиям + if ($length === 0) throw new exception('Пароль не может быть пустым'); + if ($length > 300) throw new exception('Пароль не может быть длиннее 300 символов'); + + // Генерация ответа по запрашиваемым параметрам + foreach ($return as $parameter) match ($parameter) { + 'verify' => $buffer['verify'] = true, + 'errors' => null, + default => throw new exception("Параметр не найден: $parameter") + }; + + if ($parameters['remember'] === '1') throw new exception('Запоминать пароль не безопасно'); + } catch (exception $e) { + // Запись в журнал ошибок + $this->errors['session'][] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + + // Запись реестра ошибок в буфер ответа + if (in_array('verify', $return, true)) $buffer['verify'] = false; + } + + // Запись реестра ошибок в буфер ответа + if (in_array('errors', $return, true)) $buffer['errors'] = self::parse_only_text($this->errors); + + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode($buffer); + } + + /** + * Записать код приглашения + * + * Проверяет существование приглашения с этим кодом + * и запоминает для использования в процессе регистрации + * + * @param array $parameters Параметры запроса + * + * @return string JSON-документ с запрашиваемыми параметрами + */ + public function invite(array $parameters = []): string + { + // Инициализация буфера ответа + $buffer = []; + + // Инициализация реестра возвращаемых параметров + $return = explode(',', $parameters['return'], 50); + + try { + // Проверка наличия обязательных параметров + if (empty($parameters['invite'])) throw new exception('Необходимо передать ключ приглашения'); + + // Вычисление длины + $length = strlen($parameters['invite']); + + // Проверка параметров на соответствование требованиям + if ($length === 0) throw new exception('Получен пустой ключ приглашения'); + + // Поиск приглашения + $invite = invite::read($parameters['invite'], $this->errors['session']); + + // Генерация ответа по запрашиваемым параметрам + foreach ($return as $parameter) match ($parameter) { + 'exist' => $buffer['exist'] = isset($invite->instance), + // from временное решение пока не будет разработана система сессий + 'from' => $return['from'] = ['login' => 'mirzaev'] ?? $invite->from(), + 'errors' => null, + default => throw new exception("Параметр не найден: $parameter") + }; + + if ($parameters['remember'] === '1') $this->session->remember('account.registration.invite', $parameters['invite']); + } catch (exception $e) { + // Запись в журнал ошибок + $this->errors['session'][] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + // Запись реестра ошибок в буфер ответа + if (in_array('errors', $return, true)) $buffer['errors'] = self::parse_only_text($this->errors); + + // Запись заголовка ответа + header('Content-Type: application/json'); + + return json_encode($buffer); + } +} diff --git a/mirzaev/site/account/system/controllers/traits/errors.php b/mirzaev/site/account/system/controllers/traits/errors.php new file mode 100644 index 0000000..1ca8926 --- /dev/null +++ b/mirzaev/site/account/system/controllers/traits/errors.php @@ -0,0 +1,30 @@ + + */ +trait errors +{ + private static function parse_only_text(array $errors): array + { + // Инициализация буфера вывода + $buffer = []; + + foreach ($errors as $offset => $error) { + // Перебор ошибок + + // Проверка на вложенность и запись в буфер вывода (вход в рекурсию) + if (isset($error['text'])) $buffer[] = $error['text']; + else if (is_array($error)) $buffer[$offset] = static::parse_only_text($error); + } + + return $buffer; + } +} diff --git a/mirzaev/site/account/system/models/account.php b/mirzaev/site/account/system/models/account.php new file mode 100644 index 0000000..63816d6 --- /dev/null +++ b/mirzaev/site/account/system/models/account.php @@ -0,0 +1,222 @@ + + */ +final class account extends core +{ + /** + * Коллекция + */ + public const COLLECTION = 'account'; + + /** + * Инстанция в базе данных + */ + public ?_document $instance; + + /** + * Прочитать + * + * @param string $login Входной псевдоним + * @param array &$errors Журнал ошибок + * + * @return ?self Инстанция аккаунта, если найден + */ + public static function read(string $login, array &$errors = []): ?self + { + try { + if (collection::init(static::$db->session, self::COLLECTION)) { + // Инициализирована коллекция + + // Инициализация инстанции аккаунта + $instance = new self; + + // Поиск аккаунта + $instance->instance = collection::search( + static::$db->session, + sprintf( + << $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } + + /** + * Создать + * + * @param array &$errors Журнал ошибок + * + * @return ?_document Инстанция аккаунта, если удалось создать + */ + public static function create(array &$errors = []): ?_document + { + try { + if (collection::init(static::$db->session, self::COLLECTION)) { + // Инициализирована коллекция + + // Запись аккаунта в базу данных + $_id = document::write(static::$db->session, self::COLLECTION); + + if ($account = collection::search(static::$db->session, sprintf( + << $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } + + /** + * Связь аккаунта с аккаунтом ВКонтакте + * + * @param _document $account Инстанция аккаунта + * @param _document $vk Инстанция аккаунта ВКонтакте + * @param array &$errors Журнал ошибок + * + * @return bool Статус выполнения + */ + public static function connect(_document $account, _document $vk, array &$errors = []): bool + { + try { + if ( + collection::init(static::$db->session, self::COLLECTION) + && collection::init(static::$db->session, vk::COLLECTION) + && collection::init(static::$db->session, self::COLLECTION . '_edge_' . vk::COLLECTION, true) + ) { + // Инициализированы коллекции + + if (document::write(static::$db->session, self::COLLECTION . '_edge_' . vk::COLLECTION, [ + '_from' => $account->getId(), + '_to' => $vk->getId() + ])) { + // Создано ребро: account -> vk + + return true; + } else throw new exception('Не удалось создать ребро: account -> vk'); + } else throw new exception('Не удалось инициализировать коллекцию'); + } catch (exception $e) { + // Запись в журнал ошибок + $errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return false; + } + + /** + * Поиск связанного аккаунта ВКонтакте + * + * @param _document $account Инстанция аккаунта + * @param array &$errors Журнал ошибок + * + * @return ?_document Инстанция аккаунта, если удалось найти + */ + public static function vk(_document $account, array &$errors = []): ?_document + { + try { + if ( + collection::init(static::$db->session, self::COLLECTION) + && collection::init(static::$db->session, vk::COLLECTION) + && collection::init(static::$db->session, self::COLLECTION . '_edge_' . vk::COLLECTION, true) + ) { + // Инициализирована коллекция + + if ($vk = collection::search(static::$db->session, sprintf( + <<getId() + ))) { + // Найден аккаунт ВКонтакте + + return $vk; + } else throw new exception('Не удалось найти аккаунт ВКонтакте'); + } else throw new exception('Не удалось инициализировать коллекцию'); + } catch (exception $e) { + // Запись в журнал ошибок + $errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } +} diff --git a/mirzaev/site/account/system/models/account_model.php b/mirzaev/site/account/system/models/account_model.php deleted file mode 100644 index 66cf890..0000000 --- a/mirzaev/site/account/system/models/account_model.php +++ /dev/null @@ -1,169 +0,0 @@ - - */ -final class account_model extends core -{ - /** - * Коллекция - */ - public const COLLECTION = 'account'; - - /** - * Создать - * - * @param array &$errors Журнал ошибок - * - * @return ?_document Инстанция аккаунта, если удалось создать - */ - public static function create(array &$errors = []): ?_document - { - try { - if (collection::init(static::$db->session, self::COLLECTION)) { - // Инициализирована коллекция - - // Запись аккаунта в базу данных - $_id = document::write(static::$db->session, self::COLLECTION); - - if ($account = collection::search(static::$db->session, sprintf( - << $e->getMessage(), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'stack' => $e->getTrace() - ]; - } - - return null; - } - - /** - * Связь аккаунта с аккаунтом ВКонтакте - * - * @param _document $account Инстанция аккаунта - * @param _document $vk Инстанция аккаунта ВКонтакте - * @param array &$errors Журнал ошибок - * - * @return bool Статус выполнения - */ - public static function connect(_document $account, _document $vk, array &$errors = []): bool - { - try { - if ( - collection::init(static::$db->session, self::COLLECTION) - && collection::init(static::$db->session, vk::COLLECTION) - && collection::init(static::$db->session, self::COLLECTION . '_edge_' . vk::COLLECTION, true) - ) { - // Инициализированы коллекции - - if (document::write(static::$db->session, self::COLLECTION . '_edge_' . vk::COLLECTION, [ - '_from' => $account->getId(), - '_to' => $vk->getId() - ])) { - // Создано ребро: account -> vk - - return true; - } else throw new exception('Не удалось создать ребро: account -> vk'); - } else throw new exception('Не удалось инициализировать коллекцию'); - } catch (exception $e) { - // Запись в журнал ошибок - $errors[] = [ - 'text' => $e->getMessage(), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'stack' => $e->getTrace() - ]; - } - - return false; - } - - /** - * Поиск связанного аккаунта ВКонтакте - * - * @param _document $account Инстанция аккаунта - * @param array &$errors Журнал ошибок - * - * @return ?_document Инстанция аккаунта, если удалось найти - */ - public static function vk(_document $account, array &$errors = []): ?_document - { - try { - if ( - collection::init(static::$db->session, self::COLLECTION) - && collection::init(static::$db->session, vk::COLLECTION) - && collection::init(static::$db->session, self::COLLECTION . '_edge_' . vk::COLLECTION, true) - ) { - // Инициализирована коллекция - - if ($vk = collection::search(static::$db->session, sprintf( - <<getId() - ))) { - // Найден аккаунт ВКонтакте - - return $vk; - } else throw new exception('Не удалось найти аккаунт ВКонтакте'); - } else throw new exception('Не удалось инициализировать коллекцию'); - } catch (exception $e) { - // Запись в журнал ошибок - $errors[] = [ - 'text' => $e->getMessage(), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'stack' => $e->getTrace() - ]; - } - - return null; - } -} diff --git a/mirzaev/site/account/system/models/core.php b/mirzaev/site/account/system/models/core.php index daf8fef..066a6a2 100644 --- a/mirzaev/site/account/system/models/core.php +++ b/mirzaev/site/account/system/models/core.php @@ -18,126 +18,131 @@ use exception; */ class core extends model { - /** - * Коллекция в которой хранятся аккаунты - */ - public const SETTINGS = '../settings/arangodb.php'; + /** + * Коллекция в которой хранятся аккаунты + */ + public const SETTINGS = '../settings/arangodb.php'; - /** - * Соединение с базой данных - */ - protected static connection $db; + /** + * Постфикс + */ + public string $postfix = ''; - public function __construct(connection $db = null) - { - if (isset($db)) { - // Получена инстанция соединения с базой данных + /** + * Соединение с базой данных + */ + protected static connection $db; - // Запись и инициализация соединения с базой данных - $this->__set('db', $db); + public function __construct(connection $db = null) + { + if (isset($db)) { + // Получена инстанция соединения с базой данных + + // Запись и инициализация соединения с базой данных + $this->__set('db', $db); + } else { + // Не получена инстанция соединения с базой данных + + // Инициализация соединения с базой данных по умолчанию + $this->__get('db'); + } + } + + /** + * Записать свойство + * + * @param string $name Название + * @param mixed $value Значение + */ + public function __set(string $name, mixed $value = null): void + { + match ($name) { + 'db' => (function () use ($value) { + if ($this->__isset('db')) { + // Свойство уже было инициализировано + + // Выброс исключения (неудача) + throw new exception('Запрещено реинициализировать соединение с базой данных ($this->db)', 500); } else { - // Не получена инстанция соединения с базой данных + // Свойство ещё не было инициализировано - // Инициализация соединения с базой данных по умолчанию - $this->__get('db'); + if ($value instanceof connection) { + // Передано подходящее значение + + // Запись свойства (успех) + self::$db = $value; + } else { + // Передано неподходящее значение + + // Выброс исключения (неудача) + throw new exception('Соединение с базой данных ($this->db) должен быть инстанцией mirzaev\arangodb\connection', 500); + } } - } + })(), + default => parent::__set($name, $value) + }; + } - /** - * Записать свойство - * - * @param string $name Название - * @param mixed $value Значение - */ - public function __set(string $name, mixed $value = null): void - { - match ($name) { - 'db' => (function () use ($value) { - if ($this->__isset('db')) { - // Свойство уже было инициализировано + /** + * Прочитать свойство + * + * @param string $name Название + * + * @return mixed Содержимое + */ + public function __get(string $name): mixed + { + return match ($name) { + 'db' => (function () { + if (!$this->__isset('db')) { + // Свойство не инициализировано - // Выброс исключения (неудача) - throw new exception('Запрещено реинициализировать соединение с базой данных ($this->db)', 500); - } else { - // Свойство ещё не было инициализировано + // Инициализация значения по умолчанию исходя из настроек + $this->__set('db', new connection(require static::SETTINGS)); + } - if ($value instanceof connection) { - // Передано подходящее значение + return self::$db; + })(), + default => parent::__get($name) + }; + } - // Запись свойства (успех) - self::$db = $value; - } else { - // Передано неподходящее значение + /** + * Проверить свойство на инициализированность + * + * @param string $name Название + */ + public function __isset(string $name): bool + { + return match ($name) { + default => parent::__isset($name) + }; + } - // Выброс исключения (неудача) - throw new exception('Соединение с базой данных ($this->db) должен быть инстанцией mirzaev\arangodb\connection', 500); - } - } - })(), - default => parent::__set($name, $value) - }; - } - - /** - * Прочитать свойство - * - * @param string $name Название - * - * @return mixed Содержимое - */ - public function __get(string $name): mixed - { - return match ($name) { - 'db' => (function () { - if (!$this->__isset('db')) { - // Свойство не инициализировано - - // Инициализация значения по умолчанию исходя из настроек - $this->__set('db', new connection(require static::SETTINGS)); - } - - return self::$db; - })(), - default => parent::__get($name) - }; - } - - /** - * Проверить свойство на инициализированность - * - * @param string $name Название - */ - public function __isset(string $name): bool - { - return match ($name) { - default => parent::__isset($name) - }; - } - - /** - * Удалить свойство - * - * @param string $name Название - */ - public function __unset(string $name): void - { - match ($name) { - default => parent::__isset($name) - }; - } + /** + * Удалить свойство + * + * @param string $name Название + */ + public function __unset(string $name): void + { + match ($name) { + default => parent::__isset($name) + }; + } - /** - * Статический вызов - * - * @param string $name Название - * @param array $arguments Параметры - */ - public static function __callStatic(string $name, array $arguments): mixed - { - match ($name) { - 'db' => (new static)->__get('db'), - default => throw new exception("Не найдено свойство или функция: $name", 500) - }; - } + /** + * Статический вызов + * + * @param string $name Название + * @param array $arguments Параметры + */ + public static function __callStatic(string $name, array $arguments): mixed + { + match ($name) { + 'db' => (new static)->__get('db'), + default => throw new exception("Не найдено свойство или функция: $name", 500) + }; + } } diff --git a/mirzaev/site/account/system/models/generators/password.php b/mirzaev/site/account/system/models/generators/password.php new file mode 100644 index 0000000..0b9f55b --- /dev/null +++ b/mirzaev/site/account/system/models/generators/password.php @@ -0,0 +1,159 @@ + + */ +final class password extends core +{ + /** + * Сгенерировать мнемонический пароль + * + * @param int $length Длина (количество слов) + * @param array &$errors Журнал ошибок + * + * @return ?string Пароль + */ + public static function mnemonic(int $length = 4, array &$errors = []): ?string + { + try { + preg_match_all( + '/\w+/um', + mb_convert_encoding( + <<learn($matches[0]); + + // Инициализация генератора + $generator = new generator(new rng(222, 666), $chain); + + // Генерация + $result = $generator->generate(); + + // Обрезка результата + for ($password = [], $choose = rand(0, count($result) - 20); isset($result[$choose]) && count($password) < $length; $choose++) $password[] = $result[$choose]; + + return implode(' ', $password); + } catch (exception $e) { + // Запись в журнал ошибок + $errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } + + /** + * Сгенерировать классический пароль + * + * @param int $length Длина (количество символов) + * @param array &$errors Журнал ошибок + * + * @return ?string Пароль + */ + public static function classic(int $length = 12, array &$errors = []): ?string + { + try { + // Инициализация реестра символов + $symbols = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + // Инициализация буфера пароля + $password = ''; + + // Определение максимальной длины + $max = mb_strlen($symbols, '8bit') - 1; + if ($max < 1) throw new Exception('Длина пароля должна быть не менее двух символов'); + + // Генерация пароля + for ($i = 0; $i < $length; ++$i) $password .= $symbols[random_int(0, $max)]; + + return $password; + } catch (exception $e) { + // Запись в журнал ошибок + $errors[] = [ + 'text' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } +} diff --git a/mirzaev/site/account/system/models/invite.php b/mirzaev/site/account/system/models/invite.php new file mode 100644 index 0000000..79e5a78 --- /dev/null +++ b/mirzaev/site/account/system/models/invite.php @@ -0,0 +1,90 @@ + + */ +final class invite extends core +{ + /** + * Коллекция + */ + public const COLLECTION = 'invite'; + + /** + * Инстанция в базе данных + */ + public ?_document $instance; + + /** + * Прочитать + * + * @param string $invite Ключ приглашения + * @param array &$errors Журнал ошибок + * + * @return ?self Инстанция приглашения, если оно найдено + */ + public static function read(string $invite, array &$errors = []): ?self + { + try { + if (collection::init(static::$db->session, self::COLLECTION)) { + // Инициализирована коллекция + + // Инициализация инстанции приглашения + $instance = new self; + + // Поиск приглашения + $instance->instance = collection::search( + static::$db->session, + sprintf( + << $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine(), + 'stack' => $e->getTrace() + ]; + } + + return null; + } + + public function from(): ?account + { + return new account(); + } +} diff --git a/mirzaev/site/account/system/models/session_model.php b/mirzaev/site/account/system/models/session.php similarity index 93% rename from mirzaev/site/account/system/models/session_model.php rename to mirzaev/site/account/system/models/session.php index 303eba4..c328c2b 100644 --- a/mirzaev/site/account/system/models/session_model.php +++ b/mirzaev/site/account/system/models/session.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace mirzaev\site\account\models; // Файлы проекта -use mirzaev\site\account\models\account_model as account; +use mirzaev\site\account\models\account; // Фреймворк ArangoDB use mirzaev\arangodb\collection, @@ -23,7 +23,7 @@ use exception; * @package mirzaev\site\account\models * @author Arsen Mirzaev Tatyano-Muradovich */ -final class session_model extends core +final class session extends core { /** * Коллекция @@ -122,7 +122,8 @@ final class session_model extends core } } - public function __destruct() { + public function __destruct() + { // Закрыть сессию } @@ -231,7 +232,7 @@ final class session_model extends core */ public function __set(string $name, mixed $value = null): void { - $this->document->{$name} = $value; + $this->document->{$name} = $value; } /** @@ -283,11 +284,9 @@ final class session_model extends core * * @param string $name Название * @param array $arguments Аргументы - * - * @return void */ - public function __call(string $name, array $arguments = []): mixed + public function __call(string $name, array $arguments = []) { - return $this->document->{$name}($arguments); + if (method_exists($this, $name)) return $this->document->{$name}($arguments); } } diff --git a/mirzaev/site/account/system/models/vk_model.php b/mirzaev/site/account/system/models/vk.php similarity index 97% rename from mirzaev/site/account/system/models/vk_model.php rename to mirzaev/site/account/system/models/vk.php index 63e1d27..57334c3 100644 --- a/mirzaev/site/account/system/models/vk_model.php +++ b/mirzaev/site/account/system/models/vk.php @@ -5,7 +5,7 @@ declare(strict_types=1); namespace mirzaev\site\account\models; // Файлы проекта -use mirzaev\site\account\models\account_model as account; +use mirzaev\site\account\models\account; // Фреймворк ArangoDB use mirzaev\arangodb\collection, @@ -30,7 +30,7 @@ use stdClass; * @package mirzaev\site\account\models * @author Arsen Mirzaev Tatyano-Muradovich */ -final class vk_model extends core +final class vk extends core { /** * Коллекция diff --git a/mirzaev/site/account/system/public/css/account.css b/mirzaev/site/account/system/public/css/account.css index 6802555..83a1c39 100644 --- a/mirzaev/site/account/system/public/css/account.css +++ b/mirzaev/site/account/system/public/css/account.css @@ -1,5 +1,4 @@ @keyframes glare { - 2%, 100% { left : 130%; @@ -9,27 +8,78 @@ } } -section#authentication { +main { + z-index: 1000; + top: 20%; + position: relative; + height: unset; + display: flex; + flex-direction: unset; + justify-content: center; + align-items: unset; +} + +section.panel { z-index : 1000; width : 400px; - position : relative; - margin : 25vh auto; + position : absolute; display : flex; flex-direction: column; } -section#authentication>section.header { - z-index : 1000; - height : 100px; - margin-left : -50px; - padding : 30px 0; - display : flex; - clip-path : url(#authentication-header-mask); - border-radius : 3px 3px 0 0; - animation-duration: 120s; +section.panel.medium { + width: 300px; } -section#authentication>section.header>img.avatar { +section.panel.small { + width: 220px; +} + +section.panel#mnemonic { + margin-left: -570px; +} + +section.panel#classic { + margin-left: 570px; +} + + +section.panel>section.body>ul { + margin: 0 5%; + padding: 0; + display: flex; + flex-direction: column; + gap: 4px; + list-style: square; +} + +section.panel>section.body>ul>li { + font-size: 0.8rem; + word-break: break-word; + animation-duration : .35s; + animation-name : uprise; + animation-fill-mode : forwards; + animation-timing-function: cubic-bezier(.47,0,.74,.71); +} +section.panel>section.header { + z-index : 1000; + height : 50px; + display : flex; + justify-content: center; + align-items: end; + animation-duration: 120s; + border-radius : 3px 3px 0 0; + background-color : var(--background-above); +} + +section#profile>section.header { + margin-left : -50px; + height : 100px; + padding : 30px 0; + clip-path : url(#profile-header-mask); +} + +section#profile>section.header>img.avatar { z-index : 1500; left : 6px; top : 36px; @@ -46,7 +96,7 @@ section#authentication>section.header>img.avatar { -moz-box-shadow : 0px 0px 12px 0px rgba(0, 0, 0, 0.5); } -section#authentication>section.header>img.avatar:hover { +section#profile>section.header>img.avatar:hover { left : 0; top : 30px; width : 100px; @@ -56,7 +106,7 @@ section#authentication>section.header>img.avatar:hover { -moz-box-shadow : 0px 0px 8px 0px rgba(0, 0, 0, 0.3); } -section#authentication>section.header>img.cover { +section#profile>section.header>img.cover { z-index : -5000; left : -50px; top : 0; @@ -70,7 +120,7 @@ section#authentication>section.header>img.cover { background : var(--background-above); } -section#authentication>section.header>div.glare { +section#profile>section.header>div.glare { z-index : 3000; left : -30px; top : -300px; @@ -89,11 +139,11 @@ section#authentication>section.header>div.glare { background-color : #fff; } -section#authentication>section.header>div { +section#profile>section.header>div { animation-duration: 80s; } -section#authentication>section.header>a { +section#profile>section.header>a { margin : auto; width : 100%; margin-left : 110px; @@ -107,40 +157,38 @@ section#authentication>section.header>a { text-shadow : 0 0 8px #00000080; } +section.panel>section.header>:is(h1, h2, h3) { + margin-bottom: unset; +} -section#authentication>section.body { - margin-top : -160px; - padding : 180px 30px 20px 30px; - gap : 3ex; +section.panel>section.body { + padding : 20px 30px; + gap : 10px; display : flex; flex-direction : column; - border-radius : 3px; + border-radius : 0 0 3px 3px; background-color : var(--background-above); - /* background-image : radial-gradient(circle at 70% 20%, #000000A0 0%, var(--background-above) 75%); */ - box-shadow : 0px 0px 8px 0px rgba(0, 0, 0, 0.2); - -webkit-box-shadow : 0px 0px 8px 0px rgba(0, 0, 0, 0.2); - -moz-box-shadow : 0px 0px 8px 0px rgba(0, 0, 0, 0.2); } -section#authentication>section.body>ul { +section#profile>section.body>ul { margin : unset; margin-left : 10%; - margin-bottom: 1ex; } -section#authentication>section.body ul ul { +section#profile>section.body ul ul { padding-top: 1ex; } -section#authentication>section.body ul li:not(:last-child) { +section#profile>section.body ul li:not(:last-child) { margin-bottom: 1ex; } -section#authentication>section.body div.buttons { +section#profile>section.body div.buttons { + margin-top: 10px; display: flex; } -section#authentication>section.body div.buttons>button { +section#profile>section.body div.buttons>button { padding : 1ex 2ex; cursor : pointer; border-radius : 3px; @@ -148,35 +196,35 @@ section#authentication>section.body div.buttons>button { background-color: unset; } -section#authentication>section.body div.buttons>button:hover { +section#profile>section.body div.buttons>button:hover { color: var(--text-hover); } -section#authentication>section.body div.buttons>button:active { +section#profile>section.body div.buttons>button:active { color : var(--text-active); transition: unset; } -section#authentication>section.body div.buttons>button:first-of-type { +section#profile>section.body div.buttons>button:first-of-type { margin-left : auto; margin-right: 5%; } -section#authentication>section.body div.buttons>button:last-of-type { +section#profile>section.body div.buttons>button:last-of-type { margin-right: auto; } -section#authentication>section.body div.buttons>button.accept { +section#profile>section.body div.buttons>button.accept { padding : 1ex 5ex; color : var(--text-inverse); background-color: #63954d; } -section#authentication>section.body div.buttons>button.accept:hover { +section#profile>section.body div.buttons>button.accept:hover { color : var(--text-inverse-above); background-color: #6fa259; } -section#authentication>section.body div.buttons>button.accept:active { +section#profile>section.body div.buttons>button.accept:active { background-color: #63954d; } diff --git a/mirzaev/site/account/system/public/css/animations.css b/mirzaev/site/account/system/public/css/animations.css new file mode 100644 index 0000000..65503b4 --- /dev/null +++ b/mirzaev/site/account/system/public/css/animations.css @@ -0,0 +1,23 @@ +@keyframes input-error { + 0%, + 20% { + background-color: var(--input-error); + } + + 50%, + 100% { + background-color: var(--background-above-1); + } +} + +@keyframes uprise { + 0% { + opacity: 0; + filter: blur(2px); + } + + 100% { + opacity: 1; + filter: blur(0px); + } +} diff --git a/mirzaev/site/account/system/public/css/fonts/fira.css b/mirzaev/site/account/system/public/css/fonts/fira.css new file mode 100644 index 0000000..20d7657 --- /dev/null +++ b/mirzaev/site/account/system/public/css/fonts/fira.css @@ -0,0 +1,139 @@ +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-Hair.woff2') format('woff2'), url('/fonts/fira/FiraSans-Hair.woff') format('woff'); + font-weight: 100; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-HairItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-HairItalic.woff') format('woff'); + font-weight: 100; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-UltraLight.woff2') format('woff2'), url('/fonts/fira/FiraSans-UltraLight.woff') format('woff'); + font-weight: 200; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-UltraLightItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-UltraLightItalic.woff') format('woff'); + font-weight: 200; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-Light.woff2') format('woff2'), url('/fonts/fira/FiraSans-Light.woff') format('woff'); + font-weight: 300; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-LightItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-LightItalic.woff') format('woff'); + font-weight: 300; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-Regular.woff2') format('woff2'), url('/fonts/fira/FiraSans-Regular.woff') format('woff'); + font-weight: 400; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-Italic.woff2') format('woff2'), url('/fonts/fira/FiraSans-Italic.woff') format('woff'); + font-weight: 400; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraMono-Medium.woff2') format('woff2'), url('/fonts/fira/FiraMono-Medium.woff') format('woff'); + font-weight: 500; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-MediumItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-MediumItalic.woff') format('woff'); + font-weight: 500; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-SemiBold.woff2') format('woff2'), url('/fonts/fira/FiraSans-SemiBold.woff') format('woff'); + font-weight: 600; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-SemiBoldItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-SemiBoldItalic.woff') format('woff'); + font-weight: 600; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-Bold.woff2') format('woff2'), url('/fonts/fira/FiraSans-Bold.woff') format('woff'); + font-weight: 700; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-BoldItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-BoldItalic.woff') format('woff'); + font-weight: 700; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-ExtraBold.woff2') format('woff2'), url('/fonts/fira/FiraSans-ExtraBold.woff') format('woff'); + font-weight: 800; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-ExtraBoldItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-ExtraBoldItalic.woff') format('woff'); + font-weight: 800; + font-style: italic; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-Heavy.woff2') format('woff2'), url('/fonts/fira/FiraSans-Heavy.woff') format('woff'); + font-weight: 900; + font-style: normal; +} + +@font-face { + font-family: Fira; + src: url('/fonts/fira/FiraSans-HeavyItalic.woff2') format('woff2'), url('/fonts/fira/FiraSans-HeavyItalic.woff') format('woff'); + font-weight: 900; + font-style: italic; +} + +@font-face { + font-family: Fira Mono; + src: url('/fonts/fira/FiraMono-Regular.woff2') format('woff2'), url('/fonts/fira/FiraMono-Regular.woff') format('woff'); + font-weight: 400; + font-style: normal; +} + +@font-face { + font-family: Fira Mono; + src: url('/fonts/fira/FiraMono-Bold.woff2') format('woff2'), url('/fonts/fira/FiraMono-Bold.woff') format('woff'); + font-weight: 600; + font-style: normal; +} diff --git a/mirzaev/site/account/system/public/css/fonts/hack.css b/mirzaev/site/account/system/public/css/fonts/hack.css new file mode 100644 index 0000000..90491f8 --- /dev/null +++ b/mirzaev/site/account/system/public/css/fonts/hack.css @@ -0,0 +1,63 @@ +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-regular.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-regular.woff?sha=3114f1256') format('woff'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-bold.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-bold.woff?sha=3114f1256') format('woff'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-italic.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-italic.woff?sha=3114f1256') format('woff'); + font-weight: 400; + font-style: italic; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-bolditalic.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-bolditalic.woff?sha=3114f1256') format('woff'); + font-weight: 700; + font-style: italic; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-regular-subset.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-regular-subset.woff?sha=3114f1256') format('woff'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-bold-subset.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-bold-subset.woff?sha=3114f1256') format('woff'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-italic-subset.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-italic-subset.woff?sha=3114f1256') format('woff'); + font-weight: 400; + font-style: italic; + font-display: swap; +} + +@font-face { + font-family: 'Hack'; + src: url('/fonts/hack/hack-bolditalic-subset.woff2?sha=3114f1256') format('woff2'), url('/fonts/hack/hack-bolditalic-subset.woff?sha=3114f1256') format('woff'); + font-weight: 700; + font-style: italic; + font-display: swap; +} diff --git a/mirzaev/site/account/system/public/css/icons/arrow_right.css b/mirzaev/site/account/system/public/css/icons/arrow_right.css index 57ef12d..cfacfe9 100644 --- a/mirzaev/site/account/system/public/css/icons/arrow_right.css +++ b/mirzaev/site/account/system/public/css/icons/arrow_right.css @@ -2,9 +2,9 @@ box-sizing: border-box; position: relative; display: block; - transform: scale(var(--ggs,1)); width: 22px; - height: 22px + --height: 22px; + height: var(--height); } i.arrow.right::after, @@ -13,7 +13,7 @@ i.arrow.right::before { display: block; box-sizing: border-box; position: absolute; - right: 3px + right: 3px; } i.arrow.right::after { @@ -22,12 +22,12 @@ i.arrow.right::after { border-top: 2px solid; border-right: 2px solid; transform: rotate(45deg); - bottom: 7px + bottom: 7px; } i.arrow.right::before { width: 16px; height: 2px; bottom: 10px; - background: currentColor + background: currentColor; } diff --git a/mirzaev/site/account/system/public/css/icons/keyhole.css b/mirzaev/site/account/system/public/css/icons/keyhole.css new file mode 100644 index 0000000..c6d8b80 --- /dev/null +++ b/mirzaev/site/account/system/public/css/icons/keyhole.css @@ -0,0 +1,48 @@ +i.keyhole, +i.keyhole::after, +i.keyhole::before { + display: block; + box-sizing: border-box; + border-radius: 20px; +} + +i.keyhole { + --width: 20px; + --height: 20px; + position: relative; + width: 20px; + height: 20px; + border: 2px solid; +} + +i.keyhole::after, +i.keyhole::before { + position: absolute; + content: ''; +} + +i.keyhole::before { + left: 5px; + top: 3px; + width: 6px; + height: 6px; + border: 2px solid; +} + +i.keyhole::after { + left: 7px; + bottom: 3px; + width: 2px; + height: 5px; + background: currentColor; +} + +label>i.keyhole:first-child { + left: 7px; + scale: .9; + border: 2.1px solid; +} + +i.keyhole+input { + padding-left: 34px; +} diff --git a/mirzaev/site/account/system/public/css/icons/lock.css b/mirzaev/site/account/system/public/css/icons/lock.css new file mode 100644 index 0000000..c966367 --- /dev/null +++ b/mirzaev/site/account/system/public/css/icons/lock.css @@ -0,0 +1,28 @@ +i.lock { + --width: 12px; + --height: 11px; + position: relative; + margin-top: -12px; + width: 12px; + height: 11px; + display: block; + box-sizing: border-box; + border: 2px solid; + border-top-right-radius: 50%; + border-top-left-radius: 50%; + border-bottom: transparent; +} + +i.lock::after { + left: -4px; + top: 9px; + position: absolute; + width: 16px; + height: 10px; + display: block; + box-sizing: border-box; + content: ''; + box-shadow: 0 0 0 2px; + border-radius: 2px; + border: 2px solid transparent; +} diff --git a/mirzaev/site/account/system/public/css/icons/mail.css b/mirzaev/site/account/system/public/css/icons/mail.css new file mode 100644 index 0000000..84dd454 --- /dev/null +++ b/mirzaev/site/account/system/public/css/icons/mail.css @@ -0,0 +1,30 @@ +i.mail, +i.mail::after { + --width: 18px; + --height: 14px; + height: 14px; + display: block; + box-sizing: border-box; + border: 2px solid; +} + +i.mail { + position: relative; + width: 18px; + overflow: hidden; + border-radius: 2px; +} + +i.mail::after { + position: absolute; + left: 0; + bottom: 3px; + width: 14px; + transform: rotate(-45deg); + content: ""; + border-radius: 3px; +} + +i.mail+input { + padding-left: 36px; +} diff --git a/mirzaev/site/account/system/public/css/icons/nametag.css b/mirzaev/site/account/system/public/css/icons/nametag.css new file mode 100644 index 0000000..4cd7e03 --- /dev/null +++ b/mirzaev/site/account/system/public/css/icons/nametag.css @@ -0,0 +1,34 @@ +i.nametag { + --width: 6px; + --height: 6px; + box-sizing: border-box; + position: relative; + width: 6px; + height: 6px; + display: block; + border: 2px solid; +} + +i.nametag::before { + left: -5px; + top: -5px; + position: absolute; + width: 12px; + height: 12px; + display: block; + box-sizing: border-box; + content: ''; + box-shadow: + -5px -5px 0 -3px, + 5px 5px 0 -3px, + 5px -5px 0 -3px, + -5px 5px 0 -3px; +} + +label>i.nametag:first-child { + left: 13px; +} + +i.nametag+input { + padding-left: 32px; +} diff --git a/mirzaev/site/account/system/public/css/icons/user_add.css b/mirzaev/site/account/system/public/css/icons/user_add.css new file mode 100644 index 0000000..e4ff0db --- /dev/null +++ b/mirzaev/site/account/system/public/css/icons/user_add.css @@ -0,0 +1,53 @@ +i.user.add { + --width: 20px; + --height: 18px; + width: 20px; + height: 18px; + display: block; + box-sizing: border-box; + background: + linear-gradient( + to left, + currentColor 8px, + transparent 0) + no-repeat 14px 6px/6px 2px, + linear-gradient( + to left, + currentColor 8px, + transparent 0) + no-repeat 16px 4px/2px 6px; +} + +i.user.add::after, +i.user.add::before { + content: ''; + position: absolute; + display: block; + box-sizing: border-box; + border: 2px solid +} + +i.user.add::before { + left: 2px; + top: 0; + width: 8px; + height: 8px; + border-radius: 30px; +} + +i.user.add::after { + top: 9px; + width: 12px; + height: 9px; + border-bottom: 0; + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +label>i.user.add:first-child { + left: 9px; +} + +i.user.add+input { + padding-left: 37px; +} diff --git a/mirzaev/site/account/system/public/css/main.css b/mirzaev/site/account/system/public/css/main.css index 029da1e..aba52db 100644 --- a/mirzaev/site/account/system/public/css/main.css +++ b/mirzaev/site/account/system/public/css/main.css @@ -35,11 +35,12 @@ --text : #e6e6e6; --text-hover : #fff; --text-active : #d0d0d0; - --text-inverse : 'dark'; + --text-inverse : #020202; --red-light-1 : #dc4343; --red-light : #bf3737; --red : #a43333; --red-dark : #8d2a2a; + --input-error : #6c2424; } } @@ -71,15 +72,6 @@ --link-active: #3064dd; } -* { - text-decoration: none; - outline : none; - border : none; - color : var(--text); - font-family : 'Commissioner', sans-serif; - transition : 0.1s ease-out; -} - .unselectable { -webkit-touch-callout: none; -webkit-user-select : none; @@ -89,6 +81,28 @@ user-select : none; } +.hidden { + display: none !important; + opacity: 0; +} + +* { + text-decoration: none; + outline : none; + border : none; + color : var(--text); + font-family : Fira, sans-serif; + transition : 0.1s ease-out; +} + +pre, code { + font-family: Hack, monospace; +} + +button { + cursor: pointer; +} + a { color: var(--link); } @@ -102,10 +116,60 @@ a:active { transition: unset; } +label { + position: relative; + height: 26px; + display: flex; + overflow: hidden; + border-radius: 2px; +} + +label>i:first-child { + left: 8px; + top: calc((26px - var(--height)) / 2); + position: absolute !important; + margin: auto; + color: #8c7d7d; +} + +label * { + /* color: var(--text-inverse); */ +} + +label>input { + width: 100%; + padding: 0 8px; + background-color: var(--background-above-1); +} + +label>input+button { + background-color: var(--red); +} + +i+input { + padding-left: 30px; +} + +input.error { + animation-duration : 1s; + animation-name : input-error; + animation-fill-mode : forwards; + animation-timing-function: ease-in; +} + +section.header>h1 { + font-size: 1.3rem; + line-height: 1.3rem; +} + +section.header>:is(h2, h3) { + font-size: 1.1rem; + line-height: 1.1rem; +} + body { height : 100vh; margin : 0; - overflow : hidden; background-color: var(--background); } @@ -217,6 +281,8 @@ main { height : 100%; display : flex; flex-direction: column; + justify-content : center; + align-items : center; } footer { diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraMono-Bold.woff b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Bold.woff new file mode 100644 index 0000000..735352f Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Bold.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraMono-Bold.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Bold.woff2 new file mode 100644 index 0000000..832aaab Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Bold.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraMono-Medium.woff b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Medium.woff new file mode 100644 index 0000000..a33c724 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Medium.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraMono-Medium.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Medium.woff2 new file mode 100644 index 0000000..610e9b2 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Medium.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraMono-Regular.woff b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Regular.woff new file mode 100644 index 0000000..b38ee14 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Regular.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraMono-Regular.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Regular.woff2 new file mode 100644 index 0000000..9fa44b7 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraMono-Regular.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Bold.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Bold.woff new file mode 100644 index 0000000..a8dba64 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Bold.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Bold.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Bold.woff2 new file mode 100644 index 0000000..4c550c7 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Bold.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-BoldItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BoldItalic.woff new file mode 100644 index 0000000..54895de Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BoldItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-BoldItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BoldItalic.woff2 new file mode 100644 index 0000000..9e66901 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BoldItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Book.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Book.woff new file mode 100644 index 0000000..3d39706 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Book.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Book.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Book.woff2 new file mode 100644 index 0000000..9d5db65 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Book.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-BookItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BookItalic.woff new file mode 100644 index 0000000..ae9a33e Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BookItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-BookItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BookItalic.woff2 new file mode 100644 index 0000000..84f272c Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-BookItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Eight.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Eight.woff new file mode 100644 index 0000000..4fcce27 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Eight.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Eight.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Eight.woff2 new file mode 100644 index 0000000..b5b1dfe Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Eight.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-EightItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-EightItalic.woff new file mode 100644 index 0000000..4510262 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-EightItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-EightItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-EightItalic.woff2 new file mode 100644 index 0000000..48dc9f9 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-EightItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBold.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBold.woff new file mode 100644 index 0000000..7160357 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBold.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBold.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBold.woff2 new file mode 100644 index 0000000..c343ae9 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBold.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff new file mode 100644 index 0000000..7914f0e Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 new file mode 100644 index 0000000..88aaaba Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraBoldItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLight.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLight.woff new file mode 100644 index 0000000..005d0b7 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLight.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLight.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLight.woff2 new file mode 100644 index 0000000..447bc7d Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLight.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff new file mode 100644 index 0000000..fef3e38 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 new file mode 100644 index 0000000..54016b9 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ExtraLightItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Four.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Four.woff new file mode 100644 index 0000000..4da1db7 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Four.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Four.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Four.woff2 new file mode 100644 index 0000000..95ebb7e Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Four.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-FourItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-FourItalic.woff new file mode 100644 index 0000000..a3f8468 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-FourItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-FourItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-FourItalic.woff2 new file mode 100644 index 0000000..cf40809 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-FourItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Hair.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Hair.woff new file mode 100644 index 0000000..5fbacb7 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Hair.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Hair.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Hair.woff2 new file mode 100644 index 0000000..10e7287 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Hair.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-HairItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HairItalic.woff new file mode 100644 index 0000000..f2d7f98 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HairItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-HairItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HairItalic.woff2 new file mode 100644 index 0000000..6027bad Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HairItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Heavy.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Heavy.woff new file mode 100644 index 0000000..ad5de4b Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Heavy.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Heavy.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Heavy.woff2 new file mode 100644 index 0000000..b61bf0d Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Heavy.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-HeavyItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HeavyItalic.woff new file mode 100644 index 0000000..7914da9 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HeavyItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 new file mode 100644 index 0000000..f12daf3 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-HeavyItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Italic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Italic.woff new file mode 100644 index 0000000..2980194 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Italic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Italic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Italic.woff2 new file mode 100644 index 0000000..3f63664 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Italic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Light.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Light.woff new file mode 100644 index 0000000..747071e Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Light.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Light.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Light.woff2 new file mode 100644 index 0000000..5c0e34d Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Light.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-LightItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-LightItalic.woff new file mode 100644 index 0000000..e19720a Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-LightItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-LightItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-LightItalic.woff2 new file mode 100644 index 0000000..0e9b453 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-LightItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Medium.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Medium.woff new file mode 100644 index 0000000..7d742c5 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Medium.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Medium.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Medium.woff2 new file mode 100644 index 0000000..7a1e5fc Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Medium.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-MediumItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-MediumItalic.woff new file mode 100644 index 0000000..dd5bbe6 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-MediumItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-MediumItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-MediumItalic.woff2 new file mode 100644 index 0000000..2d08f9f Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-MediumItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Regular.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Regular.woff new file mode 100644 index 0000000..d8e0363 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Regular.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Regular.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Regular.woff2 new file mode 100644 index 0000000..e766e06 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Regular.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBold.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBold.woff new file mode 100644 index 0000000..8b408d4 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBold.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBold.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBold.woff2 new file mode 100644 index 0000000..bafabb5 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBold.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff new file mode 100644 index 0000000..2592e4f Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 new file mode 100644 index 0000000..a256463 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-SemiBoldItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Thin.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Thin.woff new file mode 100644 index 0000000..f986fb5 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Thin.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Thin.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Thin.woff2 new file mode 100644 index 0000000..73e2d82 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Thin.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ThinItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ThinItalic.woff new file mode 100644 index 0000000..c90247e Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ThinItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-ThinItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ThinItalic.woff2 new file mode 100644 index 0000000..c8d3b36 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-ThinItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Two.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Two.woff new file mode 100644 index 0000000..f1db0fb Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Two.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Two.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Two.woff2 new file mode 100644 index 0000000..6b389c7 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Two.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-TwoItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-TwoItalic.woff new file mode 100644 index 0000000..f5ddbf6 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-TwoItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-TwoItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-TwoItalic.woff2 new file mode 100644 index 0000000..479ca9f Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-TwoItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Ultra.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Ultra.woff new file mode 100644 index 0000000..b42f714 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Ultra.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-Ultra.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Ultra.woff2 new file mode 100644 index 0000000..ea4c78b Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-Ultra.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraItalic.woff new file mode 100644 index 0000000..3486307 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraItalic.woff2 new file mode 100644 index 0000000..5afeecc Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLight.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLight.woff new file mode 100644 index 0000000..2c22e94 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLight.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLight.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLight.woff2 new file mode 100644 index 0000000..02eb286 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLight.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLightItalic.woff b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLightItalic.woff new file mode 100644 index 0000000..421f933 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLightItalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 new file mode 100644 index 0000000..7c48ba0 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/fira/FiraSans-UltraLightItalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bold-subset.woff b/mirzaev/site/account/system/public/fonts/hack/hack-bold-subset.woff new file mode 100644 index 0000000..a47c8aa Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bold-subset.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bold-subset.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-bold-subset.woff2 new file mode 100644 index 0000000..93d425e Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bold-subset.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bold.woff b/mirzaev/site/account/system/public/fonts/hack/hack-bold.woff new file mode 100644 index 0000000..368b913 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bold.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bold.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-bold.woff2 new file mode 100644 index 0000000..1155477 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bold.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic-subset.woff b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic-subset.woff new file mode 100644 index 0000000..0da4750 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic-subset.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic-subset.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic-subset.woff2 new file mode 100644 index 0000000..236b7de Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic-subset.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic.woff b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic.woff new file mode 100644 index 0000000..ce87fe2 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic.woff2 new file mode 100644 index 0000000..46ff1c4 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-bolditalic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-italic-subset.woff b/mirzaev/site/account/system/public/fonts/hack/hack-italic-subset.woff new file mode 100644 index 0000000..1d1f511 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-italic-subset.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-italic-subset.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-italic-subset.woff2 new file mode 100644 index 0000000..b6f5fc9 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-italic-subset.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-italic.woff b/mirzaev/site/account/system/public/fonts/hack/hack-italic.woff new file mode 100644 index 0000000..bd545e4 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-italic.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-italic.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-italic.woff2 new file mode 100644 index 0000000..1e7630c Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-italic.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-regular-subset.woff b/mirzaev/site/account/system/public/fonts/hack/hack-regular-subset.woff new file mode 100644 index 0000000..85583a5 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-regular-subset.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-regular-subset.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-regular-subset.woff2 new file mode 100644 index 0000000..1e3abb9 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-regular-subset.woff2 differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-regular.woff b/mirzaev/site/account/system/public/fonts/hack/hack-regular.woff new file mode 100644 index 0000000..e835381 Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-regular.woff differ diff --git a/mirzaev/site/account/system/public/fonts/hack/hack-regular.woff2 b/mirzaev/site/account/system/public/fonts/hack/hack-regular.woff2 new file mode 100644 index 0000000..524465c Binary files /dev/null and b/mirzaev/site/account/system/public/fonts/hack/hack-regular.woff2 differ diff --git a/mirzaev/site/account/system/public/index.php b/mirzaev/site/account/system/public/index.php index 10ccfa7..09f58f0 100644 --- a/mirzaev/site/account/system/public/index.php +++ b/mirzaev/site/account/system/public/index.php @@ -4,8 +4,13 @@ declare(strict_types=1); namespace mirzaev\site\account; -use mirzaev\minimal\core; -use mirzaev\minimal\router; +// Файлы проекта +use mirzaev\site\account\controllers\core as controller, + mirzaev\site\account\models\core as model; + +// Фреймворк +use mirzaev\minimal\core, + mirzaev\minimal\router; ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); @@ -25,12 +30,20 @@ $router = new router; $router->write('/', 'index', 'index'); $router->write('/system/hotline', 'hotline', 'index'); $router->write('/system/graph', 'graph', 'index'); -$router->write('/account/initialization', 'account', 'initialization', 'PUT'); +$router->write('/account/initialization', 'account', 'initialization', 'POST'); $router->write('/account/vk/connect', 'account', 'connect'); $router->write('/account/panel', 'account', 'panel'); +$router->write('/api/generate/password', 'api', 'password', 'POST'); +$router->write('/session/login', 'session', 'login', 'POST'); +$router->write('/session/password', 'session', 'password', 'POST'); +$router->write('/session/invite', 'session', 'invite', 'POST'); // Инициализация ядра $core = new core(namespace: __NAMESPACE__, router: $router); +// Инициализация ядер +$core->controller = new controller; +$core->model = new model; + // Обработка запроса echo $core->start(); diff --git a/mirzaev/site/account/system/public/js/account.js b/mirzaev/site/account/system/public/js/account.js index 31256b1..95a23a8 100644 --- a/mirzaev/site/account/system/public/js/account.js +++ b/mirzaev/site/account/system/public/js/account.js @@ -1,26 +1,17 @@ -"use strict"; +'use strict'; class account { - static async initialization() { - // Запрос - return fetch('https://auth.mirzaev.sexy/account/initialization', { - method: 'GET' - }); - } + static async initialization() { + // Запрос + return await fetch('https://account.mirzaev.sexy/account/initialization', { + method: 'POST', + }); + } - static authentication() { - // Инициализация аккаунта - alert(1); - this.initialization() - .then( - (response) => { - alert(2); - } - ); + static deauthentication() { + } - return true; - } - - static deauthentication() { - } + static registration() { + alert(228); + } } diff --git a/mirzaev/site/account/system/public/js/js.cookie.min.js b/mirzaev/site/account/system/public/js/cookies.min.js similarity index 98% rename from mirzaev/site/account/system/public/js/js.cookie.min.js rename to mirzaev/site/account/system/public/js/cookies.min.js index 90a7672..d40e075 100644 --- a/mirzaev/site/account/system/public/js/js.cookie.min.js +++ b/mirzaev/site/account/system/public/js/cookies.min.js @@ -1,2 +1 @@ -/*! js-cookie v3.0.1 | MIT */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t { + // Деинициализация таймера + clearTimeout(timer); + + // Вызов функции (вход в рекурсию) + timer = setTimeout(() => { + func.apply(this, args); + }, timeout); + }; +} + +// Вызов события "Инициализирован демпфер" +document.dispatchEvent( + new CustomEvent("damper.initialized", { + detail: { damper } + }) +); diff --git a/mirzaev/site/account/system/public/js/password.js b/mirzaev/site/account/system/public/js/password.js new file mode 100644 index 0000000..7099780 --- /dev/null +++ b/mirzaev/site/account/system/public/js/password.js @@ -0,0 +1,24 @@ +'use strict'; + +class password { + /** + * Сгенерировать + * + * @param {number} length Длина (количество слов в мнемоническом, либо символов в классическом) + * + * @return {object} {(string) password, (array) errors} + */ + static async generate(length = 12, type = "classic") { + return await fetch("https://account.mirzaev.sexy/api/generate/password", { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + body: `length=${length}&type=${type}&return=password,errors`, + }) + .then((response) => response.json()) + .then((data) => { + return data; + }); + } +} diff --git a/mirzaev/site/account/system/public/js/session.js b/mirzaev/site/account/system/public/js/session.js new file mode 100644 index 0000000..3a2dfea --- /dev/null +++ b/mirzaev/site/account/system/public/js/session.js @@ -0,0 +1,75 @@ +'use strict'; + +class session { + /** + * Отправить входной псевдоним на сервер + * + * Записывает входной псевдоним в сессию, а так же проверяет существование аккаунта с ним + * + * @param {string} login Входной + * + * @return {object} {(bool) exist, (array) errors} + */ + static async login(login) { + // Запрос + return await fetch('https://account.mirzaev.sexy/session/login', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: `login=${login}&remember=1&return=exist,errors` + }) + .then((response) => response.json()) + .then((data) => { + return data; + }); + } + + /** + * Отправить пароль на сервер + * + * Записывает пароль в сессию, а так же проверяет его на соответствование требованиям + * + * @param {string} password Пароль + * + * @return {object} {(bool) verify, (array) errors} + */ + static async password(password) { + // Запрос + return await fetch('https://account.mirzaev.sexy/session/password', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: `password=${password}&return=verify,errors` + }) + .then((response) => response.json()) + .then((data) => { + return data; + }); + } + + /** + * Отправить ключ приглашения на сервер + * + * Записывает ключ приглашения в сессию, а так же проверяет существование приглашения + * + * @param {string} invite Ключ приглашения + * + * @return {object} {(bool) exist, (array) from, (array) errors} + */ + static async invite(invite) { + // Запрос + return await fetch("https://account.mirzaev.sexy/session/invite", { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + body: `invite=${invite}&remember=1&return=exist,from,errors`, + }) + .then((response) => response.json()) + .then((data) => { + return data; + }); + } +} diff --git a/mirzaev/site/account/system/views/head.html b/mirzaev/site/account/system/views/head.html index 197efcb..a926b45 100644 --- a/mirzaev/site/account/system/views/head.html +++ b/mirzaev/site/account/system/views/head.html @@ -12,4 +12,7 @@ {% block css %} + + + {% endblock %} diff --git a/mirzaev/site/account/system/views/js.html b/mirzaev/site/account/system/views/js.html index 86f3cf4..a2f372b 100644 --- a/mirzaev/site/account/system/views/js.html +++ b/mirzaev/site/account/system/views/js.html @@ -1,3 +1,5 @@ {% block js %} - + + + {% endblock %} diff --git a/mirzaev/site/account/system/views/nodes/authentication.html b/mirzaev/site/account/system/views/nodes/authentication.html index 9b4047b..5b6eb7a 100644 --- a/mirzaev/site/account/system/views/nodes/authentication.html +++ b/mirzaev/site/account/system/views/nodes/authentication.html @@ -1,30 +1,247 @@ {% block css %} + + + {% endblock %} {% block body %} -
- {% if account %} - {{ account.getKey() }} - {% if vk %} - {{ vk.mail }} - {% endif %} - {% else %} +
-

Аутентификация

+

Идентификация

-
- {% endif %}
+ + + {% endblock %} {% block js %} - + + {% endblock %} diff --git a/mirzaev/site/account/system/views/nodes/connect.html b/mirzaev/site/account/system/views/nodes/connect.html index 9b71a16..5e86383 100644 --- a/mirzaev/site/account/system/views/nodes/connect.html +++ b/mirzaev/site/account/system/views/nodes/connect.html @@ -4,7 +4,7 @@ {% endblock %} {% block body %} -
+
{% if account %} {{ account.getKey() }} {% if vk %} @@ -39,7 +39,7 @@ {% endif %} - + diff --git a/mirzaev/site/account/system/views/nodes/profile.html b/mirzaev/site/account/system/views/nodes/profile.html index b85a6f5..161a139 100644 --- a/mirzaev/site/account/system/views/nodes/profile.html +++ b/mirzaev/site/account/system/views/nodes/profile.html @@ -4,7 +4,7 @@ {% endblock %} {% block body %} -
+
{% if account %} {{ account.getKey() }} {% if vk %} diff --git a/mirzaev/site/account/system/views/templater.php b/mirzaev/site/account/system/views/templater.php index db0fad6..ca7e3bf 100644 --- a/mirzaev/site/account/system/views/templater.php +++ b/mirzaev/site/account/system/views/templater.php @@ -141,7 +141,7 @@ final class templater extends controller implements ArrayAccess * * @return mixed Данные переменной из реестра глобальных переменных */ - public function &offsetGet(mixed $offset): mixed + public function offsetGet(mixed $offset): mixed { return $this->variables[$offset]; }