Browse Source

initial commit

slavavitrenko 7 years ago
parent
commit
d183cff2ad
100 changed files with 6292 additions and 1377 deletions
  1. 0 32
      LICENSE.md
  2. 0 208
      README.md
  3. 0 0
      app/assets/AppAsset.php
  4. 31 0
      app/commands/InstallController.php
  5. 23 0
      app/config/console/components.php
  6. 23 0
      app/config/console/console.php
  7. 9 0
      app/config/console/modules.php
  8. 9 0
      app/config/db.php
  9. 13 0
      app/config/mailer.php
  10. 0 0
      app/config/params.php
  11. 50 0
      app/config/web/components.php
  12. 37 0
      app/config/web/modules.php
  13. 37 0
      app/config/web/web.php
  14. 33 0
      app/controllers/SiteController.php
  15. 11 0
      app/controllers/dektriumuser/AdminController.php
  16. 17 0
      app/controllers/dektriumuser/RegistrationController.php
  17. 17 0
      app/controllers/dektriumuser/SecurityController.php
  18. 17 0
      app/controllers/dektriumuser/SettingsController.php
  19. 747 0
      app/logs/app.log
  20. 0 0
      app/mail/layouts/html.php
  21. 11 0
      app/models/dektriumuser/LoginForm.php
  22. 15 0
      app/models/dektriumuser/Profile.php
  23. 12 0
      app/models/dektriumuser/RecoveryForm.php
  24. 12 0
      app/models/dektriumuser/RegistrationForm.php
  25. 17 0
      app/models/dektriumuser/SettingsForm.php
  26. 15 0
      app/models/dektriumuser/Token.php
  27. 15 0
      app/models/dektriumuser/User.php
  28. 32 0
      app/views/dektriumuser/_alert.php
  29. 44 0
      app/views/dektriumuser/admin/_account.php
  30. 31 0
      app/views/dektriumuser/admin/_assignments.php
  31. 53 0
      app/views/dektriumuser/admin/_info.php
  32. 66 0
      app/views/dektriumuser/admin/_menu.php
  33. 50 0
      app/views/dektriumuser/admin/_profile.php
  34. 20 0
      app/views/dektriumuser/admin/_user.php
  35. 83 0
      app/views/dektriumuser/admin/create.php
  36. 137 0
      app/views/dektriumuser/admin/index.php
  37. 104 0
      app/views/dektriumuser/admin/update.php
  38. 34 0
      app/views/dektriumuser/mail/confirmation.php
  39. 64 0
      app/views/dektriumuser/mail/layouts/html.php
  40. 21 0
      app/views/dektriumuser/mail/layouts/text.php
  41. 32 0
      app/views/dektriumuser/mail/new_password.php
  42. 37 0
      app/views/dektriumuser/mail/reconfirmation.php
  43. 34 0
      app/views/dektriumuser/mail/recovery.php
  44. 26 0
      app/views/dektriumuser/mail/text/confirmation.php
  45. 22 0
      app/views/dektriumuser/mail/text/new_password.php
  46. 29 0
      app/views/dektriumuser/mail/text/reconfirmation.php
  47. 26 0
      app/views/dektriumuser/mail/text/recovery.php
  48. 32 0
      app/views/dektriumuser/mail/text/welcome.php
  49. 47 0
      app/views/dektriumuser/mail/welcome.php
  50. 20 0
      app/views/dektriumuser/message.php
  51. 59 0
      app/views/dektriumuser/profile/show.php
  52. 45 0
      app/views/dektriumuser/recovery/request.php
  53. 45 0
      app/views/dektriumuser/recovery/reset.php
  54. 63 0
      app/views/dektriumuser/registration/connect.php
  55. 54 0
      app/views/dektriumuser/registration/register.php
  56. 44 0
      app/views/dektriumuser/registration/resend.php
  57. 108 0
      app/views/dektriumuser/security/login.php
  58. 48 0
      app/views/dektriumuser/settings/_menu.php
  59. 88 0
      app/views/dektriumuser/settings/account.php
  60. 72 0
      app/views/dektriumuser/settings/networks.php
  61. 86 0
      app/views/dektriumuser/settings/profile.php
  62. 1 16
      views/layouts/main.php
  63. 0 0
      app/views/site/error.php
  64. 0 0
      app/views/site/index.php
  65. 0 37
      codeception.yml
  66. 0 30
      commands/HelloController.php
  67. 14 9
      composer.json
  68. 3338 0
      composer.lock
  69. 0 43
      config/console.php
  70. 0 9
      config/db.php
  71. 0 38
      config/test.php
  72. 0 6
      config/test_db.php
  73. 0 70
      config/web.php
  74. 0 126
      controllers/SiteController.php
  75. 12 0
      functions.php
  76. 0 64
      models/ContactForm.php
  77. 0 81
      models/LoginForm.php
  78. 0 104
      models/User.php
  79. 0 137
      requirements.php
  80. 0 2
      runtime/.gitignore
  81. 0 6
      tests/_bootstrap.php
  82. 0 1
      tests/_data/.gitkeep
  83. 0 2
      tests/_output/.gitignore
  84. 0 26
      tests/_support/AcceptanceTester.php
  85. 0 23
      tests/_support/FunctionalTester.php
  86. 0 26
      tests/_support/UnitTester.php
  87. 0 10
      tests/acceptance.suite.yml.example
  88. 0 11
      tests/acceptance/AboutCest.php
  89. 0 34
      tests/acceptance/ContactCest.php
  90. 0 17
      tests/acceptance/HomeCest.php
  91. 0 20
      tests/acceptance/LoginCest.php
  92. 0 1
      tests/acceptance/_bootstrap.php
  93. 0 29
      tests/bin/yii
  94. 0 20
      tests/bin/yii.bat
  95. 0 13
      tests/functional.suite.yml
  96. 0 56
      tests/functional/ContactFormCest.php
  97. 0 58
      tests/functional/LoginFormCest.php
  98. 0 1
      tests/functional/_bootstrap.php
  99. 0 11
      tests/unit.suite.yml
  100. 0 0
      tests/unit/_bootstrap.php

+ 0 - 32
LICENSE.md

@@ -1,32 +0,0 @@
-The Yii framework is free software. It is released under the terms of
-the following BSD License.
-
-Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in
-   the documentation and/or other materials provided with the
-   distribution.
- * Neither the name of Yii Software LLC nor the names of its
-   contributors may be used to endorse or promote products derived
-   from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.

+ 0 - 208
README.md

@@ -1,208 +0,0 @@
-Yii 2 Basic Project Template
-============================
-
-Yii 2 Basic Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
-rapidly creating small projects.
-
-The template contains the basic features including user login/logout and a contact page.
-It includes all commonly used configurations that would allow you to focus on adding new
-features to your application.
-
-[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-basic/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-basic)
-[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-basic/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-basic)
-[![Build Status](https://travis-ci.org/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-basic)
-
-DIRECTORY STRUCTURE
--------------------
-
-      assets/             contains assets definition
-      commands/           contains console commands (controllers)
-      config/             contains application configurations
-      controllers/        contains Web controller classes
-      mail/               contains view files for e-mails
-      models/             contains model classes
-      runtime/            contains files generated during runtime
-      tests/              contains various tests for the basic application
-      vendor/             contains dependent 3rd-party packages
-      views/              contains view files for the Web application
-      web/                contains the entry script and Web resources
-
-
-
-REQUIREMENTS
-------------
-
-The minimum requirement by this project template that your Web server supports PHP 5.4.0.
-
-
-INSTALLATION
-------------
-
-### Install via Composer
-
-If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions
-at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix).
-
-You can then install this project template using the following command:
-
-~~~
-php composer.phar global require "fxp/composer-asset-plugin:^1.3.1"
-php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
-~~~
-
-Now you should be able to access the application through the following URL, assuming `basic` is the directory
-directly under the Web root.
-
-~~~
-http://localhost/basic/web/
-~~~
-
-
-### Install from an Archive File
-
-Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
-a directory named `basic` that is directly under the Web root.
-
-Set cookie validation key in `config/web.php` file to some random secret string:
-
-```php
-'request' => [
-    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
-    'cookieValidationKey' => '<secret random string goes here>',
-],
-```
-
-You can then access the application through the following URL:
-
-~~~
-http://localhost/basic/web/
-~~~
-
-
-CONFIGURATION
--------------
-
-### Database
-
-Edit the file `config/db.php` with real data, for example:
-
-```php
-return [
-    'class' => 'yii\db\Connection',
-    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
-    'username' => 'root',
-    'password' => '1234',
-    'charset' => 'utf8',
-];
-```
-
-**NOTES:**
-- Yii won't create the database for you, this has to be done manually before you can access it.
-- Check and edit the other files in the `config/` directory to customize your application as required.
-- Refer to the README in the `tests` directory for information specific to basic application tests.
-
-
-
-TESTING
--------
-
-Tests are located in `tests` directory. They are developed with [Codeception PHP Testing Framework](http://codeception.com/).
-By default there are 3 test suites:
-
-- `unit`
-- `functional`
-- `acceptance`
-
-Tests can be executed by running
-
-```
-vendor/bin/codecept run
-``` 
-
-The command above will execute unit and functional tests. Unit tests are testing the system components, while functional
-tests are for testing user interaction. Acceptance tests are disabled by default as they require additional setup since
-they perform testing in real browser. 
-
-
-### Running  acceptance tests
-
-To execute acceptance tests do the following:  
-
-1. Rename `tests/acceptance.suite.yml.example` to `tests/acceptance.suite.yml` to enable suite configuration
-
-2. Replace `codeception/base` package in `composer.json` with `codeception/codeception` to install full featured
-   version of Codeception
-
-3. Update dependencies with Composer 
-
-    ```
-    composer update  
-    ```
-
-4. Download [Selenium Server](http://www.seleniumhq.org/download/) and launch it:
-
-    ```
-    java -jar ~/selenium-server-standalone-x.xx.x.jar
-    ```
-
-    In case of using Selenium Server 3.0 with Firefox browser since v48 or Google Chrome since v53 you must download [GeckoDriver](https://github.com/mozilla/geckodriver/releases) or [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/downloads) and launch Selenium with it:
-
-    ```
-    # for Firefox
-    java -jar -Dwebdriver.gecko.driver=~/geckodriver ~/selenium-server-standalone-3.xx.x.jar
-    
-    # for Google Chrome
-    java -jar -Dwebdriver.chrome.driver=~/chromedriver ~/selenium-server-standalone-3.xx.x.jar
-    ``` 
-    
-    As an alternative way you can use already configured Docker container with older versions of Selenium and Firefox:
-    
-    ```
-    docker run --net=host selenium/standalone-firefox:2.53.0
-    ```
-
-5. (Optional) Create `yii2_basic_tests` database and update it by applying migrations if you have them.
-
-   ```
-   tests/bin/yii migrate
-   ```
-
-   The database configuration can be found at `config/test_db.php`.
-
-
-6. Start web server:
-
-    ```
-    tests/bin/yii serve
-    ```
-
-7. Now you can run all available tests
-
-   ```
-   # run all available tests
-   vendor/bin/codecept run
-
-   # run acceptance tests
-   vendor/bin/codecept run acceptance
-
-   # run only unit and functional tests
-   vendor/bin/codecept run unit,functional
-   ```
-
-### Code coverage support
-
-By default, code coverage is disabled in `codeception.yml` configuration file, you should uncomment needed rows to be able
-to collect code coverage. You can run your tests and collect coverage with the following command:
-
-```
-#collect coverage for all tests
-vendor/bin/codecept run -- --coverage-html --coverage-xml
-
-#collect coverage only for unit tests
-vendor/bin/codecept run unit -- --coverage-html --coverage-xml
-
-#collect coverage for unit and functional tests
-vendor/bin/codecept run functional,unit -- --coverage-html --coverage-xml
-```
-
-You can see code coverage output under the `tests/_output` directory.

assets/AppAsset.php → app/assets/AppAsset.php


+ 31 - 0
app/commands/InstallController.php

@@ -0,0 +1,31 @@
+<?php
+/**
+ * @link http://www.yiiframework.com/
+ * @copyright Copyright (c) 2008 Yii Software LLC
+ * @license http://www.yiiframework.com/license/
+ */
+
+namespace app\commands;
+
+use yii\console\Application;
+use yii\console\Controller;
+
+class InstallController extends Controller
+{
+    public function actionIndex()
+    {
+        $oldApp = \Yii::$app;
+        new Application([
+            'id'            => 'System',
+            'basePath'      => '@app',
+            'runtimePath' => dirname(__DIR__) . '/../runtime',
+            'vendorPath' => dirname(__DIR__) . '/../vendor',
+            'components'    => [
+                'db' => $oldApp->db,
+            ],
+        ]);
+
+        \Yii::$app->runAction('migrate/up', ['migrationPath' => '@vendor/dektrium/yii2-user/migrations', 'interactive' => true]);
+        \Yii::$app = $oldApp;
+    }
+}

+ 23 - 0
app/config/console/components.php

@@ -0,0 +1,23 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:02
+ */
+
+return [
+    'cache' => [
+        'class' => 'yii\caching\FileCache',
+    ],
+    'log' => [
+        'targets' => [
+            [
+                'class' => 'yii\log\FileTarget',
+                'levels' => ['error', 'warning'],
+            ],
+        ],
+    ],
+    'mailer' => require(__DIR__ . '/../mailer.php'),
+    'db' => require(__DIR__ . '/../db.php'),
+];

+ 23 - 0
app/config/console/console.php

@@ -0,0 +1,23 @@
+<?php
+
+$config = [
+    'id' => 'basic-console',
+    'basePath' => dirname(__DIR__) . '/../',
+    'runtimePath' => dirname(__DIR__) . '/../../runtime',
+    'vendorPath' => dirname(__DIR__) . '/../../vendor',
+    'bootstrap' => ['log'],
+    'controllerNamespace' => 'app\commands',
+    'components' => require(__DIR__ . '/components.php'),
+    'modules' => require(__DIR__ . '/modules.php'),
+    'params' => require(__DIR__ . '/../params.php'),
+];
+
+if (YII_ENV_DEV) {
+    // configuration adjustments for 'dev' environment
+    $config['bootstrap'][] = 'gii';
+    $config['modules']['gii'] = [
+        'class' => 'yii\gii\Module',
+    ];
+}
+
+return $config;

+ 9 - 0
app/config/console/modules.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:04
+ */
+
+return [];

+ 9 - 0
app/config/db.php

@@ -0,0 +1,9 @@
+<?php
+
+return [
+    'class' => 'yii\db\Connection',
+    'dsn' => 'mysql:host=' . getenv('DB_HOST') . ';dbname=' . getenv('DB_NAME'),
+    'username' => getenv('DB_USER'),
+    'password' => getenv('DB_PASS'),
+    'charset' => 'utf8'
+];

+ 13 - 0
app/config/mailer.php

@@ -0,0 +1,13 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:06
+ */
+
+
+return [
+    'class' => 'yii\swiftmailer\Mailer',
+    'useFileTransport' => true,
+];

config/params.php → app/config/params.php


+ 50 - 0
app/config/web/components.php

@@ -0,0 +1,50 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:01
+ */
+
+return [
+    'request' => [
+        // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
+        'cookieValidationKey' => 'cqnasKuLkltNc9Ma2pGZduPzYBfVFOei',
+    ],
+    'cache' => [
+        'class' => 'yii\caching\FileCache',
+    ],
+    'user' => [
+            'identityClass' => 'app\models\dektriumuser\User',
+            'enableAutoLogin' => true,
+    ],
+    'errorHandler' => [
+        'errorAction' => 'site/error',
+    ],
+    'mailer' => require(__DIR__ . '/../mailer.php'),
+    'log' => [
+        'traceLevel' => YII_DEBUG ? 3 : 0,
+        'targets' => [
+            [
+                'class' => 'yii\log\FileTarget',
+                'levels' => ['error', 'warning'],
+            ],
+        ],
+    ],
+    'db' => require(__DIR__ . '/../db.php'),
+    'urlManager' => [
+        'enablePrettyUrl' => true,
+        'showScriptName' => false,
+        'rules' => [
+            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
+        ],
+    ],
+    'view' => [
+        'theme' => [
+            'pathMap' => [
+                '@dektrium/user/views' => '@app/views/dektriumuser',
+                '@dektrium/user/views/mail' => '@app/views/dektriumuser/mail',
+            ],
+        ],
+    ],
+];

+ 37 - 0
app/config/web/modules.php

@@ -0,0 +1,37 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:02
+ */
+
+return [
+    'user' => [
+        'class' => 'dektrium\user\Module',
+        'admins' => ['admin'],
+        'rememberFor' => 86400,
+        'modelMap' => [
+            'User' => 'app\models\dektriumuser\User',
+            'Profile' => 'app\models\dektriumuser\Profile',
+            'UserSearch' => 'app\models\dektriumuser\Users',
+            'LoginForm' => 'app\models\dektriumuser\LoginForm',
+            'RegistrationForm' => 'app\models\dektriumuser\RegistrationForm',
+            'SettingsForm' => 'app\models\dektriumuser\SettingsForm',
+            'RecoveryForm' => 'app\models\dektriumuser\RecoveryForm',
+            'Token' => 'app\models\dektriumuser\Token',
+        ],
+        'controllerMap' => [
+            'admin' => 'app\controllers\dektriumuser\AdminController',
+            'security' => 'app\controllers\dektriumuser\SecurityController',
+            'registration' => 'app\controllers\dektriumuser\RegistrationController',
+            'settings' => 'app\controllers\dektriumuser\SettingsController',
+        ],
+        'mailer' => [
+            'viewPath' => '@app/views/dektriumuser/mail',
+        ],
+    ],
+    'utility' => [
+        'class' => 'c006\utility\migration\Module',
+    ],
+];

+ 37 - 0
app/config/web/web.php

@@ -0,0 +1,37 @@
+<?php
+
+$params = require(__DIR__ . '/../params.php');
+
+
+$basePath =  dirname(__DIR__);
+$webroot = dirname($basePath);
+
+$config = [
+    'id' => 'basic',
+    'basePath' => dirname(__DIR__). '/../',
+    'runtimePath' => $webroot . '/../runtime',
+    'vendorPath' => $webroot . '/../vendor',
+    'bootstrap' => ['log'],
+    'components' => require(__DIR__ . '/components.php'),
+    'modules' => require(__DIR__ . '/modules.php'),
+    'params' => $params,
+];
+
+if (YII_ENV_DEV) {
+    // configuration adjustments for 'dev' environment
+    $config['bootstrap'][] = 'debug';
+    $config['modules']['debug'] = [
+        'class' => 'yii\debug\Module',
+        // uncomment the following to add your IP if you are not connecting from localhost.
+        //'allowedIPs' => ['127.0.0.1', '::1'],
+    ];
+
+    $config['bootstrap'][] = 'gii';
+    $config['modules']['gii'] = [
+        'class' => 'yii\gii\Module',
+        // uncomment the following to add your IP if you are not connecting from localhost.
+        //'allowedIPs' => ['127.0.0.1', '::1'],
+    ];
+}
+
+return $config;

+ 33 - 0
app/controllers/SiteController.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace app\controllers;
+
+use Yii;
+use yii\web\Controller;
+
+class SiteController extends Controller
+{
+
+    /**
+     * @inheritdoc
+     */
+    public function actions()
+    {
+        return [
+            'error' => [
+                'class' => 'yii\web\ErrorAction',
+            ],
+        ];
+    }
+
+    /**
+     * Displays homepage.
+     *
+     * @return string
+     */
+    public function actionIndex()
+    {
+        return $this->render('index');
+    }
+
+}

+ 11 - 0
app/controllers/dektriumuser/AdminController.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace app\controllers\dektriumuser;
+
+use dektrium\user\controllers\AdminController as BaseAdminController;
+
+
+class AdminController extends BaseAdminController
+{
+
+}

+ 17 - 0
app/controllers/dektriumuser/RegistrationController.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.04.17
+ * Time: 10:37
+ */
+
+namespace app\controllers\dektriumuser;
+
+use dektrium\user\controllers\RegistrationController as BaseRegistrationController;
+
+
+class RegistrationController extends BaseRegistrationController
+{
+
+}

+ 17 - 0
app/controllers/dektriumuser/SecurityController.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.04.17
+ * Time: 10:04
+ */
+
+namespace app\controllers\dektriumuser;
+
+use dektrium\user\controllers\SecurityController as BaseSecurityController;
+
+
+class SecurityController extends BaseSecurityController
+{
+
+}

+ 17 - 0
app/controllers/dektriumuser/SettingsController.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 20.04.17
+ * Time: 10:13
+ */
+
+namespace app\controllers\dektriumuser;
+
+use dektrium\user\controllers\SettingsController as BaseSettingsController;
+
+
+class SettingsController extends BaseSettingsController
+{
+
+}

File diff suppressed because it is too large
+ 747 - 0
app/logs/app.log


mail/layouts/html.php → app/mail/layouts/html.php


+ 11 - 0
app/models/dektriumuser/LoginForm.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace app\models\dektriumuser;
+
+use dektrium\user\models\LoginForm as BaseLoginForm;
+
+
+class LoginForm extends BaseLoginForm
+{
+
+}

+ 15 - 0
app/models/dektriumuser/Profile.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:18
+ */
+
+namespace app\models\dektriumuser;
+
+
+class Profile extends \dektrium\user\models\Profile
+{
+
+}

+ 12 - 0
app/models/dektriumuser/RecoveryForm.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace app\models\dektriumuser;
+
+
+use dektrium\user\models\RecoveryForm as BaseRecoveryForm;
+
+
+class RecoveryForm extends BaseRecoveryForm
+{
+
+}

+ 12 - 0
app/models/dektriumuser/RegistrationForm.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace app\models\dektriumuser;
+
+
+use dektrium\user\models\RegistrationForm as BaseRegistrationForm;
+
+
+class RegistrationForm extends BaseRegistrationForm
+{
+
+}

+ 17 - 0
app/models/dektriumuser/SettingsForm.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 20.04.17
+ * Time: 10:15
+ */
+
+namespace app\models\dektriumuser;
+
+use dektrium\user\models\SettingsForm as BaseSettingsForm;
+
+
+class SettingsForm extends BaseSettingsForm
+{
+
+}

+ 15 - 0
app/models/dektriumuser/Token.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:19
+ */
+
+namespace app\models\dektriumuser;
+
+
+class Token extends \dektrium\user\models\Token
+{
+
+}

+ 15 - 0
app/models/dektriumuser/User.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:17
+ */
+
+namespace app\models\dektriumuser;
+
+
+class User extends \dektrium\user\models\User
+{
+
+}

+ 32 - 0
app/views/dektriumuser/_alert.php

@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\bootstrap\Alert;
+
+/**
+ * @var dektrium\user\Module $module
+ */
+?>
+
+<?php if ($module->enableFlashMessages): ?>
+    <div class="row">
+        <div class="col-xs-12">
+            <?php foreach (Yii::$app->session->getAllFlashes() as $type => $message): ?>
+                <?php if (in_array($type, ['success', 'danger', 'warning', 'info'])): ?>
+                    <?= Alert::widget([
+                        'options' => ['class' => 'alert-dismissible alert-' . $type],
+                        'body' => $message
+                    ]) ?>
+                <?php endif ?>
+            <?php endforeach ?>
+        </div>
+    </div>
+<?php endif ?>

+ 44 - 0
app/views/dektriumuser/admin/_account.php

@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\bootstrap\ActiveForm;
+use yii\helpers\Html;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\User $user
+ */
+?>
+
+<?php $this->beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?>
+
+<?php $form = ActiveForm::begin([
+    'layout' => 'horizontal',
+    'enableAjaxValidation' => true,
+    'enableClientValidation' => false,
+    'fieldConfig' => [
+        'horizontalCssClasses' => [
+            'wrapper' => 'col-sm-9',
+        ],
+    ],
+]); ?>
+
+<?= $this->render('_user', ['form' => $form, 'user' => $user]) ?>
+
+<div class="form-group">
+    <div class="col-lg-offset-3 col-lg-9">
+        <?= Html::submitButton(Yii::t('user', 'Update'), ['class' => 'btn btn-block btn-success']) ?>
+    </div>
+</div>
+
+<?php ActiveForm::end(); ?>
+
+<?php $this->endContent() ?>

+ 31 - 0
app/views/dektriumuser/admin/_assignments.php

@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use dektrium\rbac\widgets\Assignments;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\User $user
+ */
+?>
+
+<?php $this->beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?>
+
+<?= yii\bootstrap\Alert::widget([
+    'options' => [
+        'class' => 'alert-info alert-dismissible',
+    ],
+    'body' => Yii::t('user', 'You can assign multiple roles or permissions to user by using the form below'),
+]) ?>
+
+<?= Assignments::widget(['userId' => $user->id]) ?>
+
+<?php $this->endContent() ?>

+ 53 - 0
app/views/dektriumuser/admin/_info.php

@@ -0,0 +1,53 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\User $user
+ */
+?>
+
+<?php $this->beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?>
+
+<table class="table">
+    <tr>
+        <td><strong><?= Yii::t('user', 'Registration time') ?>:</strong></td>
+        <td><?= Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$user->created_at]) ?></td>
+    </tr>
+    <?php if ($user->registration_ip !== null): ?>
+        <tr>
+            <td><strong><?= Yii::t('user', 'Registration IP') ?>:</strong></td>
+            <td><?= $user->registration_ip ?></td>
+        </tr>
+    <?php endif ?>
+    <tr>
+        <td><strong><?= Yii::t('user', 'Confirmation status') ?>:</strong></td>
+        <?php if ($user->isConfirmed): ?>
+            <td class="text-success">
+                <?= Yii::t('user', 'Confirmed at {0, date, MMMM dd, YYYY HH:mm}', [$user->confirmed_at]) ?>
+            </td>
+        <?php else: ?>
+            <td class="text-danger"><?= Yii::t('user', 'Unconfirmed') ?></td>
+        <?php endif ?>
+    </tr>
+    <tr>
+        <td><strong><?= Yii::t('user', 'Block status') ?>:</strong></td>
+        <?php if ($user->isBlocked): ?>
+            <td class="text-danger">
+                <?= Yii::t('user', 'Blocked at {0, date, MMMM dd, YYYY HH:mm}', [$user->blocked_at]) ?>
+            </td>
+        <?php else: ?>
+            <td class="text-success"><?= Yii::t('user', 'Not blocked') ?></td>
+        <?php endif ?>
+    </tr>
+</table>
+
+<?php $this->endContent() ?>

+ 66 - 0
app/views/dektriumuser/admin/_menu.php

@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\bootstrap\Nav;
+
+?>
+
+<?= Nav::widget([
+    'options' => [
+        'class' => 'nav-tabs',
+        'style' => 'margin-bottom: 15px',
+    ],
+    'items' => [
+        [
+            'label' => Yii::t('user', 'Users'),
+            'url' => ['/user/admin/index'],
+        ],
+        [
+            'label' => Yii::t('user', 'Roles'),
+            'url' => ['/rbac/role/index'],
+            'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+        ],
+        [
+            'label' => Yii::t('user', 'Permissions'),
+            'url' => ['/rbac/permission/index'],
+            'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+        ],
+        [
+            'label' => \Yii::t('user', 'Rules'),
+            'url'   => ['/rbac/rule/index'],
+            'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+        ],
+        [
+            'label' => Yii::t('user', 'Create'),
+            'items' => [
+                [
+                    'label' => Yii::t('user', 'New user'),
+                    'url' => ['/user/admin/create'],
+                ],
+                [
+                    'label' => Yii::t('user', 'New role'),
+                    'url' => ['/rbac/role/create'],
+                    'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+                ],
+                [
+                    'label' => Yii::t('user', 'New permission'),
+                    'url' => ['/rbac/permission/create'],
+                    'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+                ],
+                [
+                    'label' => \Yii::t('user', 'New rule'),
+                    'url'   => ['/rbac/rule/create'],
+                    'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+                ]
+            ],
+        ],
+    ],
+]) ?>

+ 50 - 0
app/views/dektriumuser/admin/_profile.php

@@ -0,0 +1,50 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\bootstrap\ActiveForm;
+use yii\helpers\Html;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\User $user
+ * @var dektrium\user\models\Profile $profile
+ */
+?>
+
+<?php $this->beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?>
+
+<?php $form = ActiveForm::begin([
+    'layout' => 'horizontal',
+    'enableAjaxValidation' => true,
+    'enableClientValidation' => false,
+    'fieldConfig' => [
+        'horizontalCssClasses' => [
+            'wrapper' => 'col-sm-9',
+        ],
+    ],
+]); ?>
+
+<?= $form->field($profile, 'name') ?>
+<?= $form->field($profile, 'public_email') ?>
+<?= $form->field($profile, 'website') ?>
+<?= $form->field($profile, 'location') ?>
+<?= $form->field($profile, 'gravatar_email') ?>
+<?= $form->field($profile, 'bio')->textarea() ?>
+
+<div class="form-group">
+    <div class="col-lg-offset-3 col-lg-9">
+        <?= Html::submitButton(Yii::t('user', 'Update'), ['class' => 'btn btn-block btn-success']) ?>
+    </div>
+</div>
+
+<?php ActiveForm::end(); ?>
+
+<?php $this->endContent() ?>

+ 20 - 0
app/views/dektriumuser/admin/_user.php

@@ -0,0 +1,20 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var yii\widgets\ActiveForm $form
+ * @var dektrium\user\models\User $user
+ */
+?>
+
+<?= $form->field($user, 'email')->textInput(['maxlength' => 255]) ?>
+<?= $form->field($user, 'username')->textInput(['maxlength' => 255]) ?>
+<?= $form->field($user, 'password')->passwordInput() ?>

+ 83 - 0
app/views/dektriumuser/admin/create.php

@@ -0,0 +1,83 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\bootstrap\ActiveForm;
+use yii\bootstrap\Nav;
+use yii\helpers\Html;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\User $user
+ */
+
+$this->title = Yii::t('user', 'Create a user account');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user'),]) ?>
+
+<?= $this->render('_menu') ?>
+
+<div class="row">
+    <div class="col-md-3">
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <?= Nav::widget([
+                    'options' => [
+                        'class' => 'nav-pills nav-stacked',
+                    ],
+                    'items' => [
+                        ['label' => Yii::t('user', 'Account details'), 'url' => ['/user/admin/create']],
+                        ['label' => Yii::t('user', 'Profile details'), 'options' => [
+                            'class' => 'disabled',
+                            'onclick' => 'return false;',
+                        ]],
+                        ['label' => Yii::t('user', 'Information'), 'options' => [
+                            'class' => 'disabled',
+                            'onclick' => 'return false;',
+                        ]],
+                    ],
+                ]) ?>
+            </div>
+        </div>
+    </div>
+    <div class="col-md-9">
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <div class="alert alert-info">
+                    <?= Yii::t('user', 'Credentials will be sent to the user by email') ?>.
+                    <?= Yii::t('user', 'A password will be generated automatically if not provided') ?>.
+                </div>
+                <?php $form = ActiveForm::begin([
+                    'layout' => 'horizontal',
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                    'fieldConfig' => [
+                        'horizontalCssClasses' => [
+                            'wrapper' => 'col-sm-9',
+                        ],
+                    ],
+                ]); ?>
+
+                <?= $this->render('_user', ['form' => $form, 'user' => $user]) ?>
+
+                <div class="form-group">
+                    <div class="col-lg-offset-3 col-lg-9">
+                        <?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-success']) ?>
+                    </div>
+                </div>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 137 - 0
app/views/dektriumuser/admin/index.php

@@ -0,0 +1,137 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\grid\GridView;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\web\View;
+use yii\widgets\Pjax;
+
+
+/**
+ * @var \yii\web\View $this
+ * @var \yii\data\ActiveDataProvider $dataProvider
+ * @var \dektrium\user\models\UserSearch $searchModel
+ */
+
+$this->title = Yii::t('user', 'Manage users');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
+
+<?= $this->render('/admin/_menu') ?>
+
+<?php Pjax::begin() ?>
+
+<?= GridView::widget([
+    'dataProvider' => $dataProvider,
+    'filterModel'  => $searchModel,
+    'layout'       => "{items}\n{pager}",
+    'columns' => [
+        'username',
+        'email:email',
+        [
+            'attribute' => 'registration_ip',
+            'value' => function ($model) {
+                return $model->registration_ip == null
+                    ? '<span class="not-set">' . Yii::t('user', '(not set)') . '</span>'
+                    : $model->registration_ip;
+            },
+            'format' => 'html',
+        ],
+        [
+            'attribute' => 'created_at',
+            'value' => function ($model) {
+                if (extension_loaded('intl')) {
+                    return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]);
+                } else {
+                    return date('Y-m-d G:i:s', $model->created_at);
+                }
+            },
+        ],
+
+        [
+          'attribute' => 'last_login_at',
+          'value' => function ($model) {
+            if (!$model->last_login_at || $model->last_login_at == 0) {
+                return Yii::t('user', 'Never');
+            } else if (extension_loaded('intl')) {
+                return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->last_login_at]);
+            } else {
+                return date('Y-m-d G:i:s', $model->last_login_at);
+            }
+          },
+        ],
+        [
+            'header' => Yii::t('user', 'Confirmation'),
+            'value' => function ($model) {
+                if ($model->isConfirmed) {
+                    return '<div class="text-center">
+                                <span class="text-success">' . Yii::t('user', 'Confirmed') . '</span>
+                            </div>';
+                } else {
+                    return Html::a(Yii::t('user', 'Confirm'), ['confirm', 'id' => $model->id], [
+                        'class' => 'btn btn-xs btn-success btn-block',
+                        'data-method' => 'post',
+                        'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?'),
+                    ]);
+                }
+            },
+            'format' => 'raw',
+            'visible' => Yii::$app->getModule('user')->enableConfirmation,
+        ],
+        [
+            'header' => Yii::t('user', 'Block status'),
+            'value' => function ($model) {
+                if ($model->isBlocked) {
+                    return Html::a(Yii::t('user', 'Unblock'), ['block', 'id' => $model->id], [
+                        'class' => 'btn btn-xs btn-success btn-block',
+                        'data-method' => 'post',
+                        'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?'),
+                    ]);
+                } else {
+                    return Html::a(Yii::t('user', 'Block'), ['block', 'id' => $model->id], [
+                        'class' => 'btn btn-xs btn-danger btn-block',
+                        'data-method' => 'post',
+                        'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?'),
+                    ]);
+                }
+            },
+            'format' => 'raw',
+        ],
+        [
+            'class' => 'yii\grid\ActionColumn',
+            'template' => '{switch} {resend_password} {update} {delete}',
+            'buttons' => [
+                'resend_password' => function ($url, $model, $key) {
+                    if (!$model->isAdmin) {
+                        return '
+                    <a data-method="POST" data-confirm="' . Yii::t('user', 'Are you sure?') . '" href="' . Url::to(['resend-password', 'id' => $model->id]) . '">
+                    <span title="' . Yii::t('user', 'Generate and send new password to user') . '" class="glyphicon glyphicon-envelope">
+                    </span> </a>';
+                    }
+                },
+                'switch' => function ($url, $model) {
+                    if($model->id != Yii::$app->user->id && Yii::$app->getModule('user')->enableImpersonateUser) {
+                        return Html::a('<span class="glyphicon glyphicon-user"></span>', ['/user/admin/switch', 'id' => $model->id], [
+                            'title' => Yii::t('user', 'Become this user'),
+                            'data-confirm' => Yii::t('user', 'Are you sure you want to switch to this user for the rest of this Session?'),
+                            'data-method' => 'POST',
+                        ]);
+                    }
+                }
+            ]
+        ],
+    ],
+]); ?>
+
+<?php Pjax::end() ?>

+ 104 - 0
app/views/dektriumuser/admin/update.php

@@ -0,0 +1,104 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\bootstrap\Nav;
+
+/**
+ * @var \yii\web\View $this
+ * @var \dektrium\user\models\User $user
+ * @var string $content
+ */
+
+$this->title = Yii::t('user', 'Update user account');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
+
+<?= $this->render('_menu') ?>
+
+<div class="row">
+    <div class="col-md-3">
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <?= Nav::widget([
+                    'options' => [
+                        'class' => 'nav-pills nav-stacked',
+                    ],
+                    'items' => [
+                        [
+                            'label' => Yii::t('user', 'Account details'),
+                            'url' => ['/user/admin/update', 'id' => $user->id]
+                        ],
+                        [
+                            'label' => Yii::t('user', 'Profile details'),
+                            'url' => ['/user/admin/update-profile', 'id' => $user->id]
+                        ],
+                        ['label' => Yii::t('user', 'Information'), 'url' => ['/user/admin/info', 'id' => $user->id]],
+                        [
+                            'label' => Yii::t('user', 'Assignments'),
+                            'url' => ['/user/admin/assignments', 'id' => $user->id],
+                            'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']),
+                        ],
+                        '<hr>',
+                        [
+                            'label' => Yii::t('user', 'Confirm'),
+                            'url' => ['/user/admin/confirm', 'id' => $user->id],
+                            'visible' => !$user->isConfirmed,
+                            'linkOptions' => [
+                                'class' => 'text-success',
+                                'data-method' => 'post',
+                                'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?'),
+                            ],
+                        ],
+                        [
+                            'label' => Yii::t('user', 'Block'),
+                            'url' => ['/user/admin/block', 'id' => $user->id],
+                            'visible' => !$user->isBlocked,
+                            'linkOptions' => [
+                                'class' => 'text-danger',
+                                'data-method' => 'post',
+                                'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?'),
+                            ],
+                        ],
+                        [
+                            'label' => Yii::t('user', 'Unblock'),
+                            'url' => ['/user/admin/block', 'id' => $user->id],
+                            'visible' => $user->isBlocked,
+                            'linkOptions' => [
+                                'class' => 'text-success',
+                                'data-method' => 'post',
+                                'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?'),
+                            ],
+                        ],
+                        [
+                            'label' => Yii::t('user', 'Delete'),
+                            'url' => ['/user/admin/delete', 'id' => $user->id],
+                            'linkOptions' => [
+                                'class' => 'text-danger',
+                                'data-method' => 'post',
+                                'data-confirm' => Yii::t('user', 'Are you sure you want to delete this user?'),
+                            ],
+                        ],
+                    ],
+                ]) ?>
+            </div>
+        </div>
+    </div>
+    <div class="col-md-9">
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <?= $content ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 34 - 0
app/views/dektriumuser/mail/confirmation.php

@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+
+/**
+ * @var dektrium\user\models\User $user
+ * @var dektrium\user\models\Token $token
+ */
+?>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Hello') ?>,
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Thank you for signing up on {0}', Yii::$app->name) ?>.
+    <?= Yii::t('user', 'In order to complete your registration, please click the link below') ?>.
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Html::a(Html::encode($token->url), $token->url) ?>
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.
+</p>

+ 64 - 0
app/views/dektriumuser/mail/layouts/html.php

@@ -0,0 +1,64 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var \yii\web\View $this
+ * @var yii\mail\BaseMessage $content
+ */
+?>
+<?php $this->beginPage() ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
+<head>
+    <meta name="viewport" content="width=device-width" />
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <?php $this->head() ?>
+</head>
+<body bgcolor="#f6f6f6" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; margin: 0; padding: 0;">
+<table class="body-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 20px;">
+    <tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
+        <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
+        <td class="container" bgcolor="#FFFFFF" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0; border: 1px solid #f0f0f0;">
+            <div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
+                <table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 0;">
+                    <tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
+                        <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
+                            <?php $this->beginBody() ?>
+                            <?= $content ?>
+                            <?php $this->endBody() ?>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+        </td>
+        <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
+    </tr>
+</table>
+<table class="footer-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; clear: both !important; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
+    <td class="container" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
+        <div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
+            <table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 0;">
+                <tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
+                    <td align="center" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
+                        <p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 1.6; color: #666; font-weight: normal; margin: 0 0 10px; padding: 0;">
+                            © <?= Yii::$app->name ?> <?= date('Y') ?>.
+                        </p>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </td>
+    <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
+    </tr>
+</table>
+</body>
+</html>
+<?php $this->endPage() ?>

+ 21 - 0
app/views/dektriumuser/mail/layouts/text.php

@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var string $content main view render result
+ */
+?>
+
+<?php $this->beginPage() ?>
+<?php $this->beginBody() ?>
+<?= $content ?>
+<?php $this->endBody() ?>
+<?php $this->endPage() ?>

+ 32 - 0
app/views/dektriumuser/mail/new_password.php

@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+
+/**
+ * @var dektrium\user\Module          $module
+ * @var dektrium\user\models\User     $user
+ * @var dektrium\user\models\Password $password
+ */
+
+?>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Hello') ?>,
+</p>
+
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Your account on {0} has a new password', Yii::$app->name) ?>.
+    <?= Yii::t('user', 'We have generated a password for you') ?>: <strong><?= $user->password ?></strong>
+</p>
+
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.
+</p>

+ 37 - 0
app/views/dektriumuser/mail/reconfirmation.php

@@ -0,0 +1,37 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+
+/**
+ * @var dektrium\user\models\Token $token
+ */
+?>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Hello') ?>,
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t(
+        'user',
+        'We have received a request to change the email address for your account on {0}',
+        Yii::$app->name
+    ) ?>.
+    <?= Yii::t('user', 'In order to complete your request, please click the link below') ?>.
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Html::a(Html::encode($token->getUrl()), $token->getUrl()); ?>
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.
+</p>

+ 34 - 0
app/views/dektriumuser/mail/recovery.php

@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+
+/**
+ * @var dektrium\user\models\User $user
+ * @var dektrium\user\models\Token $token
+ */
+?>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Hello') ?>,
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'We have received a request to reset the password for your account on {0}', Yii::$app->name) ?>.
+    <?= Yii::t('user', 'Please click the link below to complete your password reset') ?>.
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Html::a(Html::encode($token->url), $token->url); ?>
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+</p>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.
+</p>

+ 26 - 0
app/views/dektriumuser/mail/text/confirmation.php

@@ -0,0 +1,26 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var dektrium\user\models\User   $user
+ * @var dektrium\user\models\Token  $token
+ */
+?>
+<?= Yii::t('user', 'Hello') ?>,
+
+<?= Yii::t('user', 'Thank you for signing up on {0}', Yii::$app->name) ?>.
+<?= Yii::t('user', 'In order to complete your registration, please click the link below') ?>.
+
+<?= $token->url ?>
+
+<?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+
+<?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.

+ 22 - 0
app/views/dektriumuser/mail/text/new_password.php

@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var dektrium\user\models\User
+ */
+?>
+<?= Yii::t('user', 'Hello') ?>,
+
+<?= Yii::t('user', 'Your account on {0} has a new password', Yii::$app->name) ?>.
+<?= Yii::t('user', 'We have generated a password for you') ?>:
+<?= $user->password ?>
+
+<?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.

+ 29 - 0
app/views/dektriumuser/mail/text/reconfirmation.php

@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var dektrium\user\models\Token $token
+ */
+?>
+<?= Yii::t('user', 'Hello') ?>,
+
+<?= Yii::t(
+    'user',
+    'We have received a request to change the email address for your account on {0}',
+    Yii::$app->name
+) ?>.
+<?= Yii::t('user', 'In order to complete your request, please click the link below') ?>.
+
+<?= $token->url ?>
+
+<?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+
+<?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.

+ 26 - 0
app/views/dektriumuser/mail/text/recovery.php

@@ -0,0 +1,26 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var dektrium\user\models\User   $user
+ * @var dektrium\user\models\Token  $token
+ */
+?>
+<?= Yii::t('user', 'Hello') ?>,
+
+<?= Yii::t('user', 'We have received a request to reset the password for your account on {0}', Yii::$app->name) ?>.
+<?= Yii::t('user', 'Please click the link below to complete your password reset') ?>.
+
+<?= $token->url ?>
+
+<?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+
+<?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.

+ 32 - 0
app/views/dektriumuser/mail/text/welcome.php

@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var dektrium\user\models\User
+ */
+?>
+<?= Yii::t('user', 'Hello') ?>,
+
+<?= Yii::t('user', 'Your account on {0} has been created', Yii::$app->name) ?>.
+<?php if ($module->enableGeneratingPassword): ?>
+<?= Yii::t('user', 'We have generated a password for you') ?>:
+<?= $user->password ?>
+<?php endif ?>
+
+<?php if ($token !== null): ?>
+<?= Yii::t('user', 'In order to complete your registration, please click the link below') ?>.
+
+<?= $token->url ?>
+
+<?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+<?php endif ?>
+
+<?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.

+ 47 - 0
app/views/dektriumuser/mail/welcome.php

@@ -0,0 +1,47 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+
+/**
+ * @var dektrium\user\Module $module
+ * @var dektrium\user\models\User $user
+ * @var dektrium\user\models\Token $token
+ * @var bool $showPassword
+ */
+?>
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Hello') ?>,
+</p>
+
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'Your account on {0} has been created', Yii::$app->name) ?>.
+    <?php if ($showPassword || $module->enableGeneratingPassword): ?>
+        <?= Yii::t('user', 'We have generated a password for you') ?>: <strong><?= $user->password ?></strong>
+    <?php endif ?>
+
+</p>
+
+<?php if ($token !== null): ?>
+    <p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+        <?= Yii::t('user', 'In order to complete your registration, please click the link below') ?>.
+    </p>
+    <p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+        <?= Html::a(Html::encode($token->url), $token->url); ?>
+    </p>
+    <p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+        <?= Yii::t('user', 'If you cannot click the link, please try pasting the text into your browser') ?>.
+    </p>
+<?php endif ?>
+
+<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
+    <?= Yii::t('user', 'If you did not make this request you can ignore this email') ?>.
+</p>

+ 20 - 0
app/views/dektriumuser/message.php

@@ -0,0 +1,20 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\Module $module
+ */
+
+$this->title = $title;
+?>
+
+<?= $this->render('/_alert', ['module' => $module]);

+ 59 - 0
app/views/dektriumuser/profile/show.php

@@ -0,0 +1,59 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+
+/**
+ * @var \yii\web\View $this
+ * @var \dektrium\user\models\Profile $profile
+ */
+
+$this->title = empty($profile->name) ? Html::encode($profile->user->username) : Html::encode($profile->name);
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="row">
+    <div class="col-xs-12 col-sm-6 col-md-6">
+        <div class="row">
+            <div class="col-sm-6 col-md-4">
+                <?= Html::img($profile->getAvatarUrl(230), [
+                    'class' => 'img-rounded img-responsive',
+                    'alt' => $profile->user->username,
+                ]) ?>
+            </div>
+            <div class="col-sm-6 col-md-8">
+                <h4><?= $this->title ?></h4>
+                <ul style="padding: 0; list-style: none outside none;">
+                    <?php if (!empty($profile->location)): ?>
+                        <li>
+                            <i class="glyphicon glyphicon-map-marker text-muted"></i> <?= Html::encode($profile->location) ?>
+                        </li>
+                    <?php endif; ?>
+                    <?php if (!empty($profile->website)): ?>
+                        <li>
+                            <i class="glyphicon glyphicon-globe text-muted"></i> <?= Html::a(Html::encode($profile->website), Html::encode($profile->website)) ?>
+                        </li>
+                    <?php endif; ?>
+                    <?php if (!empty($profile->public_email)): ?>
+                        <li>
+                            <i class="glyphicon glyphicon-envelope text-muted"></i> <?= Html::a(Html::encode($profile->public_email), 'mailto:' . Html::encode($profile->public_email)) ?>
+                        </li>
+                    <?php endif; ?>
+                    <li>
+                        <i class="glyphicon glyphicon-time text-muted"></i> <?= Yii::t('user', 'Joined on {0, date}', $profile->user->created_at) ?>
+                    </li>
+                </ul>
+                <?php if (!empty($profile->bio)): ?>
+                    <p><?= Html::encode($profile->bio) ?></p>
+                <?php endif; ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 45 - 0
app/views/dektriumuser/recovery/request.php

@@ -0,0 +1,45 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var yii\widgets\ActiveForm $form
+ * @var dektrium\user\models\RecoveryForm $model
+ */
+
+$this->title = Yii::t('user', 'Recover your password');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="row">
+    <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'password-recovery-form',
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                ]); ?>
+
+                <?= $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
+
+                <?= Html::submitButton(Yii::t('user', 'Continue'), ['class' => 'btn btn-primary btn-block']) ?><br>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 45 - 0
app/views/dektriumuser/recovery/reset.php

@@ -0,0 +1,45 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var yii\widgets\ActiveForm $form
+ * @var dektrium\user\models\RecoveryForm $model
+ */
+
+$this->title = Yii::t('user', 'Reset your password');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="row">
+    <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'password-recovery-form',
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                ]); ?>
+
+                <?= $form->field($model, 'password')->passwordInput() ?>
+
+                <?= Html::submitButton(Yii::t('user', 'Finish'), ['class' => 'btn btn-success btn-block']) ?><br>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 63 - 0
app/views/dektriumuser/registration/connect.php

@@ -0,0 +1,63 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var yii\widgets\ActiveForm $form
+ * @var dektrium\user\models\User $model
+ * @var dektrium\user\models\Account $account
+ */
+
+$this->title = Yii::t('user', 'Sign in');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="row">
+    <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <div class="alert alert-info">
+                    <p>
+                        <?= Yii::t(
+                            'user',
+                            'In order to finish your registration, we need you to enter following fields'
+                        ) ?>:
+                    </p>
+                </div>
+                <?php $form = ActiveForm::begin([
+                    'id' => 'connect-account-form',
+                ]); ?>
+
+                <?= $form->field($model, 'email') ?>
+
+                <?= $form->field($model, 'username') ?>
+
+                <?= Html::submitButton(Yii::t('user', 'Continue'), ['class' => 'btn btn-success btn-block']) ?>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+        <p class="text-center">
+            <?= Html::a(
+                Yii::t(
+                    'user',
+                    'If you already registered, sign in and connect this account on settings page'
+                ),
+                ['/user/settings/networks']
+            ) ?>.
+        </p>
+    </div>
+</div>

+ 54 - 0
app/views/dektriumuser/registration/register.php

@@ -0,0 +1,54 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\User $model
+ * @var dektrium\user\Module $module
+ */
+
+$this->title = Yii::t('user', 'Sign up');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="row">
+    <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'registration-form',
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                ]); ?>
+
+                <?= $form->field($model, 'email') ?>
+
+                <?= $form->field($model, 'username') ?>
+
+                <?php if ($module->enableGeneratingPassword == false): ?>
+                    <?= $form->field($model, 'password')->passwordInput() ?>
+                <?php endif ?>
+
+                <?= Html::submitButton(Yii::t('user', 'Sign up'), ['class' => 'btn btn-success btn-block']) ?>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+        <p class="text-center">
+            <?= Html::a(Yii::t('user', 'Already registered? Sign in!'), ['/user/security/login']) ?>
+        </p>
+    </div>
+</div>

+ 44 - 0
app/views/dektriumuser/registration/resend.php

@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\ResendForm $model
+ */
+
+$this->title = Yii::t('user', 'Request new confirmation message');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="row">
+    <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'resend-form',
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                ]); ?>
+
+                <?= $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
+
+                <?= Html::submitButton(Yii::t('user', 'Continue'), ['class' => 'btn btn-primary btn-block']) ?><br>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 108 - 0
app/views/dektriumuser/security/login.php

@@ -0,0 +1,108 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use dektrium\user\widgets\Connect;
+use dektrium\user\models\LoginForm;
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var dektrium\user\models\LoginForm $model
+ * @var dektrium\user\Module $module
+ */
+
+$this->title = Yii::t('user', 'Sign in');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
+
+<div class="row">
+    <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'login-form',
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                    'validateOnBlur' => false,
+                    'validateOnType' => false,
+                    'validateOnChange' => false,
+                ]) ?>
+
+                <?php if ($module->debug): ?>
+                    <?= $form->field($model, 'login', [
+                        'inputOptions' => [
+                            'autofocus' => 'autofocus',
+                            'class' => 'form-control',
+                            'tabindex' => '1']])->dropDownList(LoginForm::loginList());
+                    ?>
+
+                <?php else: ?>
+
+                    <?= $form->field($model, 'login',
+                        ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']]
+                    );
+                    ?>
+
+                <?php endif ?>
+
+                <?php if ($module->debug): ?>
+                    <div class="alert alert-warning">
+                        <?= Yii::t('user', 'Password is not necessary because the module is in DEBUG mode.'); ?>
+                    </div>
+                <?php else: ?>
+                    <?= $form->field(
+                        $model,
+                        'password',
+                        ['inputOptions' => ['class' => 'form-control', 'tabindex' => '2']])
+                        ->passwordInput()
+                        ->label(
+                            Yii::t('user', 'Password')
+                            . ($module->enablePasswordRecovery ?
+                                ' (' . Html::a(
+                                    Yii::t('user', 'Forgot password?'),
+                                    ['/user/recovery/request'],
+                                    ['tabindex' => '5']
+                                )
+                                . ')' : '')
+                        ) ?>
+                <?php endif ?>
+
+                <?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '3']) ?>
+
+                <?= Html::submitButton(
+                    Yii::t('user', 'Sign in'),
+                    ['class' => 'btn btn-primary btn-block', 'tabindex' => '4']
+                ) ?>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+        <?php if ($module->enableConfirmation): ?>
+            <p class="text-center">
+                <?= Html::a(Yii::t('user', 'Didn\'t receive confirmation message?'), ['/user/registration/resend']) ?>
+            </p>
+        <?php endif ?>
+        <?php if ($module->enableRegistration): ?>
+            <p class="text-center">
+                <?= Html::a(Yii::t('user', 'Don\'t have an account? Sign up!'), ['/user/registration/register']) ?>
+            </p>
+        <?php endif ?>
+        <?= Connect::widget([
+            'baseAuthUrl' => ['/user/security/auth'],
+        ]) ?>
+    </div>
+</div>

+ 48 - 0
app/views/dektriumuser/settings/_menu.php

@@ -0,0 +1,48 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\Menu;
+
+/**
+ * @var dektrium\user\models\User $user
+ */
+
+$user = Yii::$app->user->identity;
+$networksVisible = count(Yii::$app->authClientCollection->clients) > 0;
+?>
+<div class="panel panel-default">
+    <div class="panel-heading">
+        <h3 class="panel-title">
+            <?= Html::img($user->profile->getAvatarUrl(24), [
+                'class' => 'img-rounded',
+                'alt' => $user->username,
+            ]) ?>
+            <?= $user->username ?>
+        </h3>
+    </div>
+    <div class="panel-body">
+        <?= Menu::widget([
+            'options' => [
+                'class' => 'nav nav-pills nav-stacked',
+            ],
+            'items' => [
+                ['label' => Yii::t('user', 'Profile'), 'url' => ['/user/settings/profile']],
+                ['label' => Yii::t('user', 'Account'), 'url' => ['/user/settings/account']],
+                [
+                    'label' => Yii::t('user', 'Networks'),
+                    'url' => ['/user/settings/networks'],
+                    'visible' => $networksVisible
+                ],
+            ],
+        ]) ?>
+    </div>
+</div>

+ 88 - 0
app/views/dektriumuser/settings/account.php

@@ -0,0 +1,88 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/**
+ * @var yii\web\View $this
+ * @var yii\widgets\ActiveForm $form
+ * @var dektrium\user\models\SettingsForm $model
+ */
+
+$this->title = Yii::t('user', 'Account settings');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
+
+<div class="row">
+    <div class="col-md-3">
+        <?= $this->render('_menu') ?>
+    </div>
+    <div class="col-md-9">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'account-form',
+                    'options' => ['class' => 'form-horizontal'],
+                    'fieldConfig' => [
+                        'template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>",
+                        'labelOptions' => ['class' => 'col-lg-3 control-label'],
+                    ],
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                ]); ?>
+
+                <?= $form->field($model, 'email') ?>
+
+                <?= $form->field($model, 'username') ?>
+
+                <?= $form->field($model, 'new_password')->passwordInput() ?>
+
+                <hr/>
+
+                <?= $form->field($model, 'current_password')->passwordInput() ?>
+
+                <div class="form-group">
+                    <div class="col-lg-offset-3 col-lg-9">
+                        <?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-success']) ?><br>
+                    </div>
+                </div>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+
+        <?php if ($model->module->enableAccountDelete): ?>
+            <div class="panel panel-danger">
+                <div class="panel-heading">
+                    <h3 class="panel-title"><?= Yii::t('user', 'Delete account') ?></h3>
+                </div>
+                <div class="panel-body">
+                    <p>
+                        <?= Yii::t('user', 'Once you delete your account, there is no going back') ?>.
+                        <?= Yii::t('user', 'It will be deleted forever') ?>.
+                        <?= Yii::t('user', 'Please be certain') ?>.
+                    </p>
+                    <?= Html::a(Yii::t('user', 'Delete account'), ['delete'], [
+                        'class' => 'btn btn-danger',
+                        'data-method' => 'post',
+                        'data-confirm' => Yii::t('user', 'Are you sure? There is no going back'),
+                    ]) ?>
+                </div>
+            </div>
+        <?php endif ?>
+    </div>
+</div>

+ 72 - 0
app/views/dektriumuser/settings/networks.php

@@ -0,0 +1,72 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use dektrium\user\widgets\Connect;
+use yii\helpers\Html;
+
+/**
+ * @var $this yii\web\View
+ * @var $form yii\widgets\ActiveForm
+ */
+
+$this->title = Yii::t('user', 'Networks');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
+
+<div class="row">
+    <div class="col-md-3">
+        <?= $this->render('_menu') ?>
+    </div>
+    <div class="col-md-9">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <?= Html::encode($this->title) ?>
+            </div>
+            <div class="panel-body">
+                <div class="alert alert-info">
+                    <p><?= Yii::t('user', 'You can connect multiple accounts to be able to log in using them') ?>.</p>
+                </div>
+                <?php $auth = Connect::begin([
+                    'baseAuthUrl' => ['/user/security/auth'],
+                    'accounts' => $user->accounts,
+                    'autoRender' => false,
+                    'popupMode' => false,
+                ]) ?>
+                <table class="table">
+                    <?php foreach ($auth->getClients() as $client): ?>
+                        <tr>
+                            <td style="width: 32px; vertical-align: middle">
+                                <?= Html::tag('span', '', ['class' => 'auth-icon ' . $client->getName()]) ?>
+                            </td>
+                            <td style="vertical-align: middle">
+                                <strong><?= $client->getTitle() ?></strong>
+                            </td>
+                            <td style="width: 120px">
+                                <?= $auth->isConnected($client) ?
+                                    Html::a(Yii::t('user', 'Disconnect'), $auth->createClientUrl($client), [
+                                        'class' => 'btn btn-danger btn-block',
+                                        'data-method' => 'post',
+                                    ]) :
+                                    Html::a(Yii::t('user', 'Connect'), $auth->createClientUrl($client), [
+                                        'class' => 'btn btn-success btn-block',
+                                    ])
+                                ?>
+                            </td>
+                        </tr>
+                    <?php endforeach; ?>
+                </table>
+                <?php Connect::end() ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 86 - 0
app/views/dektriumuser/settings/profile.php

@@ -0,0 +1,86 @@
+<?php
+
+/*
+ * This file is part of the Dektrium project.
+ *
+ * (c) Dektrium project <http://github.com/dektrium>
+ *
+ * For the full copyright and license information, please view the LICENSE.md
+ * file that was distributed with this source code.
+ */
+
+use yii\helpers\Html;
+use dektrium\user\helpers\Timezone;
+use yii\widgets\ActiveForm;
+use yii\helpers\ArrayHelper;
+
+/**
+ * @var yii\web\View $this
+ * @var yii\widgets\ActiveForm $form
+ * @var dektrium\user\models\Profile $model
+ */
+
+$this->title = Yii::t('user', 'Profile settings');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+<?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
+
+<div class="row">
+    <div class="col-md-3">
+        <?= $this->render('_menu') ?>
+    </div>
+    <div class="col-md-9">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <?= Html::encode($this->title) ?>
+            </div>
+            <div class="panel-body">
+                <?php $form = ActiveForm::begin([
+                    'id' => 'profile-form',
+                    'options' => ['class' => 'form-horizontal'],
+                    'fieldConfig' => [
+                        'template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>",
+                        'labelOptions' => ['class' => 'col-lg-3 control-label'],
+                    ],
+                    'enableAjaxValidation' => true,
+                    'enableClientValidation' => false,
+                    'validateOnBlur' => false,
+                ]); ?>
+
+                <?= $form->field($model, 'name') ?>
+
+                <?= $form->field($model, 'public_email') ?>
+
+                <?= $form->field($model, 'website') ?>
+
+                <?= $form->field($model, 'location') ?>
+
+                <?= $form
+                    ->field($model, 'timezone')
+                    ->dropDownList(
+                        ArrayHelper::map(
+                            Timezone::getAll(),
+                            'timezone',
+                            'name'
+                        )
+                    ); ?>
+
+                <?= $form
+                    ->field($model, 'gravatar_email')
+                    ->hint(Html::a(Yii::t('user', 'Change your avatar at Gravatar.com'), 'http://gravatar.com')) ?>
+
+                <?= $form->field($model, 'bio')->textarea() ?>
+
+                <div class="form-group">
+                    <div class="col-lg-offset-3 col-lg-9">
+                        <?= Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-success']) ?>
+                        <br>
+                    </div>
+                </div>
+
+                <?php ActiveForm::end(); ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 1 - 16
views/layouts/main.php

@@ -16,7 +16,6 @@ AppAsset::register($this);
 <html lang="<?= Yii::$app->language ?>">
 <head>
     <meta charset="<?= Yii::$app->charset ?>">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <?= Html::csrfMetaTags() ?>
     <title><?= Html::encode($this->title) ?></title>
@@ -37,21 +36,7 @@ AppAsset::register($this);
     echo Nav::widget([
         'options' => ['class' => 'navbar-nav navbar-right'],
         'items' => [
-            ['label' => 'Home', 'url' => ['/site/index']],
-            ['label' => 'About', 'url' => ['/site/about']],
-            ['label' => 'Contact', 'url' => ['/site/contact']],
-            Yii::$app->user->isGuest ? (
-                ['label' => 'Login', 'url' => ['/site/login']]
-            ) : (
-                '<li>'
-                . Html::beginForm(['/site/logout'], 'post')
-                . Html::submitButton(
-                    'Logout (' . Yii::$app->user->identity->username . ')',
-                    ['class' => 'btn btn-link logout']
-                )
-                . Html::endForm()
-                . '</li>'
-            )
+
         ],
     ]);
     NavBar::end();

views/site/error.php → app/views/site/error.php


views/site/index.php → app/views/site/index.php


+ 0 - 37
codeception.yml

@@ -1,37 +0,0 @@
-actor: Tester
-paths:
-    tests: tests
-    log: tests/_output
-    data: tests/_data
-    helpers: tests/_support
-settings:
-    bootstrap: _bootstrap.php
-    memory_limit: 1024M
-    colors: true
-modules:
-    config:
-        Yii2:
-            configFile: 'config/test.php'
-            cleanup: false
-
-# To enable code coverage:
-#coverage:
-#    #c3_url: http://localhost:8080/index-test.php/
-#    enabled: true
-#    #remote: true
-#    #remote_config: '../codeception.yml'
-#    whitelist:
-#        include:
-#            - models/*
-#            - controllers/*
-#            - commands/*
-#            - mail/*
-#    blacklist:
-#        include:
-#            - assets/*
-#            - config/*
-#            - runtime/*
-#            - vendor/*
-#            - views/*
-#            - web/*
-#            - tests/*

+ 0 - 30
commands/HelloController.php

@@ -1,30 +0,0 @@
-<?php
-/**
- * @link http://www.yiiframework.com/
- * @copyright Copyright (c) 2008 Yii Software LLC
- * @license http://www.yiiframework.com/license/
- */
-
-namespace app\commands;
-
-use yii\console\Controller;
-
-/**
- * This command echoes the first argument that you have entered.
- *
- * This command is provided as an example for you to learn how to create console commands.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @since 2.0
- */
-class HelloController extends Controller
-{
-    /**
-     * This command echoes what you have entered as the message.
-     * @param string $message the message to be echoed.
-     */
-    public function actionIndex($message = 'hello world')
-    {
-        echo $message . "\n";
-    }
-}

+ 14 - 9
composer.json

@@ -1,6 +1,6 @@
 {
-    "name": "yiisoft/yii2-app-basic",
-    "description": "Yii 2 Basic Project Template",
+    "name": "slavavitrenko/yii2-app-basic",
+    "description": "Yii 2 Basic Project Template (yii2-app-basic clone)",
     "keywords": ["yii2", "framework", "basic", "project template"],
     "homepage": "http://www.yiiframework.com/",
     "type": "project",
@@ -12,12 +12,15 @@
         "irc": "irc://irc.freenode.net/yii",
         "source": "https://github.com/yiisoft/yii2"
     },
-    "minimum-stability": "dev",
+    "minimum-stability": "stable",
     "require": {
         "php": ">=5.4.0",
         "yiisoft/yii2": "~2.0.5",
         "yiisoft/yii2-bootstrap": "~2.0.0",
-        "yiisoft/yii2-swiftmailer": "~2.0.0"
+        "yiisoft/yii2-swiftmailer": "~2.0.0",
+        "dektrium/yii2-user": "^0.9.12",
+        "vlucas/phpdotenv": "^2.4",
+        "c006/yii2-migration-utility": "dev-master"
     },
     "require-dev": {
         "yiisoft/yii2-debug": "~2.0.0",
@@ -29,7 +32,13 @@
         "codeception/specify": "~0.4.3"
     },
     "config": {
-        "process-timeout": 1800
+        "process-timeout": 1800,
+        "fxp-asset": {
+            "installer-paths": {
+                "npm-asset-library": "vendor/npm",
+                "bower-asset-library": "vendor/bower"
+            }
+        }
     },
     "scripts": {
         "post-create-project-cmd": [
@@ -48,10 +57,6 @@
             "generateCookieValidationKey": [
                 "config/web.php"
             ]
-        },
-        "asset-installer-paths": {
-            "npm-asset-library": "vendor/npm",
-            "bower-asset-library": "vendor/bower"
         }
     }
 }

File diff suppressed because it is too large
+ 3338 - 0
composer.lock


+ 0 - 43
config/console.php

@@ -1,43 +0,0 @@
-<?php
-
-$params = require(__DIR__ . '/params.php');
-$db = require(__DIR__ . '/db.php');
-
-$config = [
-    'id' => 'basic-console',
-    'basePath' => dirname(__DIR__),
-    'bootstrap' => ['log'],
-    'controllerNamespace' => 'app\commands',
-    'components' => [
-        'cache' => [
-            'class' => 'yii\caching\FileCache',
-        ],
-        'log' => [
-            'targets' => [
-                [
-                    'class' => 'yii\log\FileTarget',
-                    'levels' => ['error', 'warning'],
-                ],
-            ],
-        ],
-        'db' => $db,
-    ],
-    'params' => $params,
-    /*
-    'controllerMap' => [
-        'fixture' => [ // Fixture generation command line.
-            'class' => 'yii\faker\FixtureController',
-        ],
-    ],
-    */
-];
-
-if (YII_ENV_DEV) {
-    // configuration adjustments for 'dev' environment
-    $config['bootstrap'][] = 'gii';
-    $config['modules']['gii'] = [
-        'class' => 'yii\gii\Module',
-    ];
-}
-
-return $config;

+ 0 - 9
config/db.php

@@ -1,9 +0,0 @@
-<?php
-
-return [
-    'class' => 'yii\db\Connection',
-    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
-    'username' => 'root',
-    'password' => '',
-    'charset' => 'utf8',
-];

+ 0 - 38
config/test.php

@@ -1,38 +0,0 @@
-<?php
-$params = require(__DIR__ . '/params.php');
-$dbParams = require(__DIR__ . '/test_db.php');
-
-/**
- * Application configuration shared by all test types
- */
-return [
-    'id' => 'basic-tests',
-    'basePath' => dirname(__DIR__),    
-    'language' => 'en-US',
-    'components' => [
-        'db' => $dbParams,
-        'mailer' => [
-            'useFileTransport' => true,
-        ],
-        'assetManager' => [            
-            'basePath' => __DIR__ . '/../web/assets',
-        ],
-        'urlManager' => [
-            'showScriptName' => true,
-        ],
-        'user' => [
-            'identityClass' => 'app\models\User',
-        ],        
-        'request' => [
-            'cookieValidationKey' => 'test',
-            'enableCsrfValidation' => false,
-            // but if you absolutely need it set cookie domain to localhost
-            /*
-            'csrfCookie' => [
-                'domain' => 'localhost',
-            ],
-            */
-        ],        
-    ],
-    'params' => $params,
-];

+ 0 - 6
config/test_db.php

@@ -1,6 +0,0 @@
-<?php
-$db = require(__DIR__ . '/db.php');
-// test database! Important not to run tests on production or development databases
-$db['dsn'] = 'mysql:host=localhost;dbname=yii2_basic_tests';
-
-return $db;

+ 0 - 70
config/web.php

@@ -1,70 +0,0 @@
-<?php
-
-$params = require(__DIR__ . '/params.php');
-
-$config = [
-    'id' => 'basic',
-    'basePath' => dirname(__DIR__),
-    'bootstrap' => ['log'],
-    'components' => [
-        'request' => [
-            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
-            'cookieValidationKey' => '',
-        ],
-        'cache' => [
-            'class' => 'yii\caching\FileCache',
-        ],
-        'user' => [
-            'identityClass' => 'app\models\User',
-            'enableAutoLogin' => true,
-        ],
-        'errorHandler' => [
-            'errorAction' => 'site/error',
-        ],
-        'mailer' => [
-            'class' => 'yii\swiftmailer\Mailer',
-            // send all mails to a file by default. You have to set
-            // 'useFileTransport' to false and configure a transport
-            // for the mailer to send real emails.
-            'useFileTransport' => true,
-        ],
-        'log' => [
-            'traceLevel' => YII_DEBUG ? 3 : 0,
-            'targets' => [
-                [
-                    'class' => 'yii\log\FileTarget',
-                    'levels' => ['error', 'warning'],
-                ],
-            ],
-        ],
-        'db' => require(__DIR__ . '/db.php'),
-        /*
-        'urlManager' => [
-            'enablePrettyUrl' => true,
-            'showScriptName' => false,
-            'rules' => [
-            ],
-        ],
-        */
-    ],
-    'params' => $params,
-];
-
-if (YII_ENV_DEV) {
-    // configuration adjustments for 'dev' environment
-    $config['bootstrap'][] = 'debug';
-    $config['modules']['debug'] = [
-        'class' => 'yii\debug\Module',
-        // uncomment the following to add your IP if you are not connecting from localhost.
-        //'allowedIPs' => ['127.0.0.1', '::1'],
-    ];
-
-    $config['bootstrap'][] = 'gii';
-    $config['modules']['gii'] = [
-        'class' => 'yii\gii\Module',
-        // uncomment the following to add your IP if you are not connecting from localhost.
-        //'allowedIPs' => ['127.0.0.1', '::1'],
-    ];
-}
-
-return $config;

+ 0 - 126
controllers/SiteController.php

@@ -1,126 +0,0 @@
-<?php
-
-namespace app\controllers;
-
-use Yii;
-use yii\filters\AccessControl;
-use yii\web\Controller;
-use yii\web\Response;
-use yii\filters\VerbFilter;
-use app\models\LoginForm;
-use app\models\ContactForm;
-
-class SiteController extends Controller
-{
-    /**
-     * @inheritdoc
-     */
-    public function behaviors()
-    {
-        return [
-            'access' => [
-                'class' => AccessControl::className(),
-                'only' => ['logout'],
-                'rules' => [
-                    [
-                        'actions' => ['logout'],
-                        'allow' => true,
-                        'roles' => ['@'],
-                    ],
-                ],
-            ],
-            'verbs' => [
-                'class' => VerbFilter::className(),
-                'actions' => [
-                    'logout' => ['post'],
-                ],
-            ],
-        ];
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function actions()
-    {
-        return [
-            'error' => [
-                'class' => 'yii\web\ErrorAction',
-            ],
-            'captcha' => [
-                'class' => 'yii\captcha\CaptchaAction',
-                'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
-            ],
-        ];
-    }
-
-    /**
-     * Displays homepage.
-     *
-     * @return string
-     */
-    public function actionIndex()
-    {
-        return $this->render('index');
-    }
-
-    /**
-     * Login action.
-     *
-     * @return Response|string
-     */
-    public function actionLogin()
-    {
-        if (!Yii::$app->user->isGuest) {
-            return $this->goHome();
-        }
-
-        $model = new LoginForm();
-        if ($model->load(Yii::$app->request->post()) && $model->login()) {
-            return $this->goBack();
-        }
-        return $this->render('login', [
-            'model' => $model,
-        ]);
-    }
-
-    /**
-     * Logout action.
-     *
-     * @return Response
-     */
-    public function actionLogout()
-    {
-        Yii::$app->user->logout();
-
-        return $this->goHome();
-    }
-
-    /**
-     * Displays contact page.
-     *
-     * @return Response|string
-     */
-    public function actionContact()
-    {
-        $model = new ContactForm();
-        if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
-            Yii::$app->session->setFlash('contactFormSubmitted');
-
-            return $this->refresh();
-        }
-        return $this->render('contact', [
-            'model' => $model,
-        ]);
-    }
-
-    /**
-     * Displays about page.
-     *
-     * @return string
-     */
-    public function actionAbout()
-    {
-        return $this->render('about');
-    }
-}

+ 12 - 0
functions.php

@@ -0,0 +1,12 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: slava
+ * Date: 13.05.17
+ * Time: 17:45
+ */
+
+function DMF($data){
+    var_dump($data);
+    die();
+}

+ 0 - 64
models/ContactForm.php

@@ -1,64 +0,0 @@
-<?php
-
-namespace app\models;
-
-use Yii;
-use yii\base\Model;
-
-/**
- * ContactForm is the model behind the contact form.
- */
-class ContactForm extends Model
-{
-    public $name;
-    public $email;
-    public $subject;
-    public $body;
-    public $verifyCode;
-
-
-    /**
-     * @return array the validation rules.
-     */
-    public function rules()
-    {
-        return [
-            // name, email, subject and body are required
-            [['name', 'email', 'subject', 'body'], 'required'],
-            // email has to be a valid email address
-            ['email', 'email'],
-            // verifyCode needs to be entered correctly
-            ['verifyCode', 'captcha'],
-        ];
-    }
-
-    /**
-     * @return array customized attribute labels
-     */
-    public function attributeLabels()
-    {
-        return [
-            'verifyCode' => 'Verification Code',
-        ];
-    }
-
-    /**
-     * Sends an email to the specified email address using the information collected by this model.
-     * @param string $email the target email address
-     * @return bool whether the model passes validation
-     */
-    public function contact($email)
-    {
-        if ($this->validate()) {
-            Yii::$app->mailer->compose()
-                ->setTo($email)
-                ->setFrom([$this->email => $this->name])
-                ->setSubject($this->subject)
-                ->setTextBody($this->body)
-                ->send();
-
-            return true;
-        }
-        return false;
-    }
-}

+ 0 - 81
models/LoginForm.php

@@ -1,81 +0,0 @@
-<?php
-
-namespace app\models;
-
-use Yii;
-use yii\base\Model;
-
-/**
- * LoginForm is the model behind the login form.
- *
- * @property User|null $user This property is read-only.
- *
- */
-class LoginForm extends Model
-{
-    public $username;
-    public $password;
-    public $rememberMe = true;
-
-    private $_user = false;
-
-
-    /**
-     * @return array the validation rules.
-     */
-    public function rules()
-    {
-        return [
-            // username and password are both required
-            [['username', 'password'], 'required'],
-            // rememberMe must be a boolean value
-            ['rememberMe', 'boolean'],
-            // password is validated by validatePassword()
-            ['password', 'validatePassword'],
-        ];
-    }
-
-    /**
-     * Validates the password.
-     * This method serves as the inline validation for password.
-     *
-     * @param string $attribute the attribute currently being validated
-     * @param array $params the additional name-value pairs given in the rule
-     */
-    public function validatePassword($attribute, $params)
-    {
-        if (!$this->hasErrors()) {
-            $user = $this->getUser();
-
-            if (!$user || !$user->validatePassword($this->password)) {
-                $this->addError($attribute, 'Incorrect username or password.');
-            }
-        }
-    }
-
-    /**
-     * Logs in a user using the provided username and password.
-     * @return bool whether the user is logged in successfully
-     */
-    public function login()
-    {
-        if ($this->validate()) {
-            return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
-        }
-        return false;
-    }
-
-    /**
-     * Finds user by [[username]]
-     *
-     * @return User|null
-     */
-    public function getUser()
-    {
-        if ($this->_user === false) {
-            $this->_user = User::findByUsername($this->username);
-        }
-
-        return $this->_user;
-    }
-}

+ 0 - 104
models/User.php

@@ -1,104 +0,0 @@
-<?php
-
-namespace app\models;
-
-class User extends \yii\base\Object implements \yii\web\IdentityInterface
-{
-    public $id;
-    public $username;
-    public $password;
-    public $authKey;
-    public $accessToken;
-
-    private static $users = [
-        '100' => [
-            'id' => '100',
-            'username' => 'admin',
-            'password' => 'admin',
-            'authKey' => 'test100key',
-            'accessToken' => '100-token',
-        ],
-        '101' => [
-            'id' => '101',
-            'username' => 'demo',
-            'password' => 'demo',
-            'authKey' => 'test101key',
-            'accessToken' => '101-token',
-        ],
-    ];
-
-
-    /**
-     * @inheritdoc
-     */
-    public static function findIdentity($id)
-    {
-        return isset(self::$users[$id]) ? new static(self::$users[$id]) : null;
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public static function findIdentityByAccessToken($token, $type = null)
-    {
-        foreach (self::$users as $user) {
-            if ($user['accessToken'] === $token) {
-                return new static($user);
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Finds user by username
-     *
-     * @param string $username
-     * @return static|null
-     */
-    public static function findByUsername($username)
-    {
-        foreach (self::$users as $user) {
-            if (strcasecmp($user['username'], $username) === 0) {
-                return new static($user);
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function getAuthKey()
-    {
-        return $this->authKey;
-    }
-
-    /**
-     * @inheritdoc
-     */
-    public function validateAuthKey($authKey)
-    {
-        return $this->authKey === $authKey;
-    }
-
-    /**
-     * Validates password
-     *
-     * @param string $password password to validate
-     * @return bool if password provided is valid for current user
-     */
-    public function validatePassword($password)
-    {
-        return $this->password === $password;
-    }
-}

+ 0 - 137
requirements.php

@@ -1,137 +0,0 @@
-<?php
-/**
- * Application requirement checker script.
- *
- * In order to run this script use the following console command:
- * php requirements.php
- *
- * In order to run this script from the web, you should copy it to the web root.
- * If you are using Linux you can create a hard link instead, using the following command:
- * ln ../requirements.php requirements.php
- */
-
-// you may need to adjust this path to the correct Yii framework path
-$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2';
-
-if (!is_dir($frameworkPath)) {
-    echo '<h1>Error</h1>';
-    echo '<p><strong>The path to yii framework seems to be incorrect.</strong></p>';
-    echo '<p>You need to install Yii framework via composer or adjust the framework path in file <abbr title="' . __FILE__ . '">' . basename(__FILE__) . '</abbr>.</p>';
-    echo '<p>Please refer to the <abbr title="' . dirname(__FILE__) . '/README.md">README</abbr> on how to install Yii.</p>';
-}
-
-require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
-$requirementsChecker = new YiiRequirementChecker();
-
-$gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.';
-$gdOK = $imagickOK = false;
-
-if (extension_loaded('imagick')) {
-    $imagick = new Imagick();
-    $imagickFormats = $imagick->queryFormats('PNG');
-    if (in_array('PNG', $imagickFormats)) {
-        $imagickOK = true;
-    } else {
-        $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.';
-    }
-}
-
-if (extension_loaded('gd')) {
-    $gdInfo = gd_info();
-    if (!empty($gdInfo['FreeType Support'])) {
-        $gdOK = true;
-    } else {
-        $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.';
-    }
-}
-
-/**
- * Adjust requirements according to your application specifics.
- */
-$requirements = array(
-    // Database :
-    array(
-        'name' => 'PDO extension',
-        'mandatory' => true,
-        'condition' => extension_loaded('pdo'),
-        'by' => 'All DB-related classes',
-    ),
-    array(
-        'name' => 'PDO SQLite extension',
-        'mandatory' => false,
-        'condition' => extension_loaded('pdo_sqlite'),
-        'by' => 'All DB-related classes',
-        'memo' => 'Required for SQLite database.',
-    ),
-    array(
-        'name' => 'PDO MySQL extension',
-        'mandatory' => false,
-        'condition' => extension_loaded('pdo_mysql'),
-        'by' => 'All DB-related classes',
-        'memo' => 'Required for MySQL database.',
-    ),
-    array(
-        'name' => 'PDO PostgreSQL extension',
-        'mandatory' => false,
-        'condition' => extension_loaded('pdo_pgsql'),
-        'by' => 'All DB-related classes',
-        'memo' => 'Required for PostgreSQL database.',
-    ),
-    // Cache :
-    array(
-        'name' => 'Memcache extension',
-        'mandatory' => false,
-        'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
-        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-memcache.html">MemCache</a>',
-        'memo' => extension_loaded('memcached') ? 'To use memcached set <a href="http://www.yiiframework.com/doc-2.0/yii-caching-memcache.html#$useMemcached-detail">MemCache::useMemcached</a> to <code>true</code>.' : ''
-    ),
-    // CAPTCHA:
-    array(
-        'name' => 'GD PHP extension with FreeType support',
-        'mandatory' => false,
-        'condition' => $gdOK,
-        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-captcha-captcha.html">Captcha</a>',
-        'memo' => $gdMemo,
-    ),
-    array(
-        'name' => 'ImageMagick PHP extension with PNG support',
-        'mandatory' => false,
-        'condition' => $imagickOK,
-        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-captcha-captcha.html">Captcha</a>',
-        'memo' => $imagickMemo,
-    ),
-    // PHP ini :
-    'phpExposePhp' => array(
-        'name' => 'Expose PHP',
-        'mandatory' => false,
-        'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
-        'by' => 'Security reasons',
-        'memo' => '"expose_php" should be disabled at php.ini',
-    ),
-    'phpAllowUrlInclude' => array(
-        'name' => 'PHP allow url include',
-        'mandatory' => false,
-        'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
-        'by' => 'Security reasons',
-        'memo' => '"allow_url_include" should be disabled at php.ini',
-    ),
-    'phpSmtp' => array(
-        'name' => 'PHP mail SMTP',
-        'mandatory' => false,
-        'condition' => strlen(ini_get('SMTP')) > 0,
-        'by' => 'Email sending',
-        'memo' => 'PHP mail SMTP server required',
-    ),
-);
-
-// OPcache check
-if (!version_compare(phpversion(), '5.5', '>=')) {
-    $requirements[] = array(
-        'name' => 'APC extension',
-        'mandatory' => false,
-        'condition' => extension_loaded('apc'),
-        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-apccache.html">ApcCache</a>',
-    );
-}
-
-$requirementsChecker->checkYii()->check($requirements)->render();

+ 0 - 2
runtime/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 6
tests/_bootstrap.php

@@ -1,6 +0,0 @@
-<?php
-define('YII_ENV', 'test');
-defined('YII_DEBUG') or define('YII_DEBUG', true);
-
-require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
-require __DIR__ .'/../vendor/autoload.php';

+ 0 - 1
tests/_data/.gitkeep

@@ -1 +0,0 @@
-

+ 0 - 2
tests/_output/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 0 - 26
tests/_support/AcceptanceTester.php

@@ -1,26 +0,0 @@
-<?php
-
-
-/**
- * Inherited Methods
- * @method void wantToTest($text)
- * @method void wantTo($text)
- * @method void execute($callable)
- * @method void expectTo($prediction)
- * @method void expect($prediction)
- * @method void amGoingTo($argumentation)
- * @method void am($role)
- * @method void lookForwardTo($achieveValue)
- * @method void comment($description)
- * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
- *
- * @SuppressWarnings(PHPMD)
-*/
-class AcceptanceTester extends \Codeception\Actor
-{
-    use _generated\AcceptanceTesterActions;
-
-   /**
-    * Define custom actions here
-    */
-}

+ 0 - 23
tests/_support/FunctionalTester.php

@@ -1,23 +0,0 @@
-<?php
-
-
-/**
- * Inherited Methods
- * @method void wantToTest($text)
- * @method void wantTo($text)
- * @method void execute($callable)
- * @method void expectTo($prediction)
- * @method void expect($prediction)
- * @method void amGoingTo($argumentation)
- * @method void am($role)
- * @method void lookForwardTo($achieveValue)
- * @method void comment($description)
- * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
- *
- * @SuppressWarnings(PHPMD)
-*/
-class FunctionalTester extends \Codeception\Actor
-{
-    use _generated\FunctionalTesterActions;
-
-}

+ 0 - 26
tests/_support/UnitTester.php

@@ -1,26 +0,0 @@
-<?php
-
-
-/**
- * Inherited Methods
- * @method void wantToTest($text)
- * @method void wantTo($text)
- * @method void execute($callable)
- * @method void expectTo($prediction)
- * @method void expect($prediction)
- * @method void amGoingTo($argumentation)
- * @method void am($role)
- * @method void lookForwardTo($achieveValue)
- * @method void comment($description)
- * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
- *
- * @SuppressWarnings(PHPMD)
-*/
-class UnitTester extends \Codeception\Actor
-{
-    use _generated\UnitTesterActions;
-
-   /**
-    * Define custom actions here
-    */
-}

+ 0 - 10
tests/acceptance.suite.yml.example

@@ -1,10 +0,0 @@
-class_name: AcceptanceTester
-modules:
-    enabled:
-        - WebDriver:
-            url: http://127.0.0.1:8080/
-            browser: firefox
-        - Yii2:
-            part: orm
-            entryScript: index-test.php
-            cleanup: false

+ 0 - 11
tests/acceptance/AboutCest.php

@@ -1,11 +0,0 @@
-<?php
-use yii\helpers\Url as Url;
-
-class AboutCest
-{
-    public function ensureThatAboutWorks(AcceptanceTester $I)
-    {
-        $I->amOnPage(Url::toRoute('/site/about'));
-        $I->see('About', 'h1');
-    }
-}

+ 0 - 34
tests/acceptance/ContactCest.php

@@ -1,34 +0,0 @@
-<?php
-
-use yii\helpers\Url as Url;
-
-class ContactCest
-{
-    public function _before(\AcceptanceTester $I)
-    {
-        $I->amOnPage(Url::toRoute('/site/contact'));
-    }
-    
-    public function contactPageWorks(AcceptanceTester $I)
-    {
-        $I->wantTo('ensure that contact page works');
-        $I->see('Contact', 'h1');
-    }
-
-    public function contactFormCanBeSubmitted(AcceptanceTester $I)
-    {
-        $I->amGoingTo('submit contact form with correct data');
-        $I->fillField('#contactform-name', 'tester');
-        $I->fillField('#contactform-email', 'tester@example.com');
-        $I->fillField('#contactform-subject', 'test subject');
-        $I->fillField('#contactform-body', 'test content');
-        $I->fillField('#contactform-verifycode', 'testme');
-
-        $I->click('contact-button');
-        
-        $I->wait(2); // wait for button to be clicked
-
-        $I->dontSeeElement('#contact-form');
-        $I->see('Thank you for contacting us. We will respond to you as soon as possible.');
-    }
-}

+ 0 - 17
tests/acceptance/HomeCest.php

@@ -1,17 +0,0 @@
-<?php
-use yii\helpers\Url as Url;
-
-class HomeCest
-{
-    public function ensureThatHomePageWorks(AcceptanceTester $I)
-    {
-        $I->amOnPage(Url::toRoute('/site/index'));        
-        $I->see('My Company');
-        
-        $I->seeLink('About');
-        $I->click('About');
-        $I->wait(2); // wait for page to be opened
-        
-        $I->see('This is the About page.');
-    }
-}

+ 0 - 20
tests/acceptance/LoginCest.php

@@ -1,20 +0,0 @@
-<?php
-use yii\helpers\Url as Url;
-
-class LoginCest
-{
-    public function ensureThatLoginWorks(AcceptanceTester $I)
-    {
-        $I->amOnPage(Url::toRoute('/site/login'));
-        $I->see('Login', 'h1');
-
-        $I->amGoingTo('try to login with correct credentials');
-        $I->fillField('input[name="LoginForm[username]"]', 'admin');
-        $I->fillField('input[name="LoginForm[password]"]', 'admin');
-        $I->click('login-button');
-        $I->wait(2); // wait for button to be clicked
-
-        $I->expectTo('see user info');
-        $I->see('Logout');
-    }
-}

+ 0 - 1
tests/acceptance/_bootstrap.php

@@ -1 +0,0 @@
-<?php

+ 0 - 29
tests/bin/yii

@@ -1,29 +0,0 @@
-#!/usr/bin/env php
-<?php
-/**
- * Yii console bootstrap file.
- *
- * @link http://www.yiiframework.com/
- * @copyright Copyright (c) 2008 Yii Software LLC
- * @license http://www.yiiframework.com/license/
- */
-
-defined('YII_DEBUG') or define('YII_DEBUG', true);
-defined('YII_ENV') or define('YII_ENV', 'test');
-
-require(__DIR__ . '/../../vendor/autoload.php');
-require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
-
-$config = yii\helpers\ArrayHelper::merge(
-    require(__DIR__ . '/../../config/console.php'),
-    [
-        'components' => [
-            'db' => require(__DIR__ . '/../../config/test_db.php')
-        ]
-    ]
-);
-
-
-$application = new yii\console\Application($config);
-$exitCode = $application->run();
-exit($exitCode);

+ 0 - 20
tests/bin/yii.bat

@@ -1,20 +0,0 @@
-@echo off
-
-rem -------------------------------------------------------------
-rem  Yii command line bootstrap script for Windows.
-rem
-rem  @author Qiang Xue <qiang.xue@gmail.com>
-rem  @link http://www.yiiframework.com/
-rem  @copyright Copyright (c) 2008 Yii Software LLC
-rem  @license http://www.yiiframework.com/license/
-rem -------------------------------------------------------------
-
-@setlocal
-
-set YII_PATH=%~dp0
-
-if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
-
-"%PHP_COMMAND%" "%YII_PATH%yii" %*
-
-@endlocal

+ 0 - 13
tests/functional.suite.yml

@@ -1,13 +0,0 @@
-# Codeception Test Suite Configuration
-
-# suite for functional (integration) tests.
-# emulate web requests and make application process them.
-# (tip: better to use with frameworks).
-
-# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
-#basic/web/index.php
-class_name: FunctionalTester
-modules:
-    enabled:
-      - Filesystem
-      - Yii2

+ 0 - 56
tests/functional/ContactFormCest.php

@@ -1,56 +0,0 @@
-<?php
-class ContactFormCest 
-{
-    public function _before(\FunctionalTester $I)
-    {
-        $I->amOnPage(['site/contact']);
-    }
-
-    public function openContactPage(\FunctionalTester $I)
-    {
-        $I->see('Contact', 'h1');        
-    }
-
-    public function submitEmptyForm(\FunctionalTester $I)
-    {
-        $I->submitForm('#contact-form', []);
-        $I->expectTo('see validations errors');
-        $I->see('Contact', 'h1');
-        $I->see('Name cannot be blank');
-        $I->see('Email cannot be blank');
-        $I->see('Subject cannot be blank');
-        $I->see('Body cannot be blank');
-        $I->see('The verification code is incorrect');
-    }
-
-    public function submitFormWithIncorrectEmail(\FunctionalTester $I)
-    {
-        $I->submitForm('#contact-form', [
-            'ContactForm[name]' => 'tester',
-            'ContactForm[email]' => 'tester.email',
-            'ContactForm[subject]' => 'test subject',
-            'ContactForm[body]' => 'test content',
-            'ContactForm[verifyCode]' => 'testme',
-        ]);
-        $I->expectTo('see that email address is wrong');
-        $I->dontSee('Name cannot be blank', '.help-inline');
-        $I->see('Email is not a valid email address.');
-        $I->dontSee('Subject cannot be blank', '.help-inline');
-        $I->dontSee('Body cannot be blank', '.help-inline');
-        $I->dontSee('The verification code is incorrect', '.help-inline');        
-    }
-
-    public function submitFormSuccessfully(\FunctionalTester $I)
-    {
-        $I->submitForm('#contact-form', [
-            'ContactForm[name]' => 'tester',
-            'ContactForm[email]' => 'tester@example.com',
-            'ContactForm[subject]' => 'test subject',
-            'ContactForm[body]' => 'test content',
-            'ContactForm[verifyCode]' => 'testme',
-        ]);
-        $I->seeEmailIsSent();
-        $I->dontSeeElement('#contact-form');
-        $I->see('Thank you for contacting us. We will respond to you as soon as possible.');        
-    }
-}

+ 0 - 58
tests/functional/LoginFormCest.php

@@ -1,58 +0,0 @@
-<?php
-class LoginFormCest
-{
-    public function _before(\FunctionalTester $I)
-    {
-        $I->amOnRoute('site/login');
-    }
-
-    public function openLoginPage(\FunctionalTester $I)
-    {
-        $I->see('Login', 'h1');
-
-    }
-
-    // demonstrates `amLoggedInAs` method
-    public function internalLoginById(\FunctionalTester $I)
-    {
-        $I->amLoggedInAs(100);
-        $I->amOnPage('/');
-        $I->see('Logout (admin)');
-    }
-
-    // demonstrates `amLoggedInAs` method
-    public function internalLoginByInstance(\FunctionalTester $I)
-    {
-        $I->amLoggedInAs(\app\models\User::findByUsername('admin'));
-        $I->amOnPage('/');
-        $I->see('Logout (admin)');
-    }
-
-    public function loginWithEmptyCredentials(\FunctionalTester $I)
-    {
-        $I->submitForm('#login-form', []);
-        $I->expectTo('see validations errors');
-        $I->see('Username cannot be blank.');
-        $I->see('Password cannot be blank.');
-    }
-
-    public function loginWithWrongCredentials(\FunctionalTester $I)
-    {
-        $I->submitForm('#login-form', [
-            'LoginForm[username]' => 'admin',
-            'LoginForm[password]' => 'wrong',
-        ]);
-        $I->expectTo('see validations errors');
-        $I->see('Incorrect username or password.');
-    }
-
-    public function loginSuccessfully(\FunctionalTester $I)
-    {
-        $I->submitForm('#login-form', [
-            'LoginForm[username]' => 'admin',
-            'LoginForm[password]' => 'admin',
-        ]);
-        $I->see('Logout (admin)');
-        $I->dontSeeElement('form#login-form');              
-    }
-}

+ 0 - 1
tests/functional/_bootstrap.php

@@ -1 +0,0 @@
-<?php

+ 0 - 11
tests/unit.suite.yml

@@ -1,11 +0,0 @@
-# Codeception Test Suite Configuration
-
-# suite for unit (internal) tests.
-# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
-
-class_name: UnitTester
-modules:
-    enabled:
-      - Asserts
-      - Yii2:
-            part: [orm, email]

+ 0 - 0
tests/unit/_bootstrap.php


Some files were not shown because too many files changed in this diff