Browse Source

删除部分代码

zxiansheng 4 năm trước cách đây
mục cha
commit
20a73a1944
65 tập tin đã thay đổi với 3 bổ sung2034 xóa
  1. 1 25
      README.md
  2. 0 77
      Vagrantfile
  3. 0 9
      codeception.yml
  4. 0 14
      console/config/main.php
  5. 1 1
      console/config/params.php
  6. 0 23
      frontend/assets/AppAsset.php
  7. 0 15
      frontend/codeception.yml
  8. 0 3
      frontend/config/.gitignore
  9. 0 1
      frontend/config/bootstrap.php
  10. 0 48
      frontend/config/main.php
  11. 0 4
      frontend/config/params.php
  12. 0 12
      frontend/config/test.php
  13. 0 220
      frontend/controllers/SiteController.php
  14. 0 60
      frontend/models/ContactForm.php
  15. 0 68
      frontend/models/PasswordResetRequestForm.php
  16. 0 64
      frontend/models/ResetPasswordForm.php
  17. 0 58
      frontend/models/SignupForm.php
  18. 0 2
      frontend/runtime/.gitignore
  19. 0 9
      frontend/tests/_bootstrap.php
  20. 0 13
      frontend/tests/_data/login_data.php
  21. 0 23
      frontend/tests/_data/user.php
  22. 0 2
      frontend/tests/_output/.gitignore
  23. 0 1
      frontend/tests/_support/.gitignore
  24. 0 33
      frontend/tests/_support/FunctionalTester.php
  25. 0 25
      frontend/tests/_support/UnitTester.php
  26. 0 9
      frontend/tests/acceptance.suite.yml.example
  27. 0 20
      frontend/tests/acceptance/HomeCest.php
  28. 0 16
      frontend/tests/acceptance/_bootstrap.php
  29. 0 6
      frontend/tests/functional.suite.yml
  30. 0 13
      frontend/tests/functional/AboutCest.php
  31. 0 59
      frontend/tests/functional/ContactCest.php
  32. 0 17
      frontend/tests/functional/HomeCest.php
  33. 0 60
      frontend/tests/functional/LoginCest.php
  34. 0 57
      frontend/tests/functional/SignupCest.php
  35. 0 16
      frontend/tests/functional/_bootstrap.php
  36. 0 7
      frontend/tests/unit.suite.yml
  37. 0 16
      frontend/tests/unit/_bootstrap.php
  38. 0 32
      frontend/tests/unit/models/ContactFormTest.php
  39. 0 59
      frontend/tests/unit/models/PasswordResetRequestFormTest.php
  40. 0 44
      frontend/tests/unit/models/ResetPasswordFormTest.php
  41. 0 59
      frontend/tests/unit/models/SignupFormTest.php
  42. 0 83
      frontend/views/layouts/main.php
  43. 0 16
      frontend/views/site/about.php
  44. 0 45
      frontend/views/site/contact.php
  45. 0 27
      frontend/views/site/error.php
  46. 0 53
      frontend/views/site/index.php
  47. 0 39
      frontend/views/site/login.php
  48. 0 31
      frontend/views/site/requestPasswordResetToken.php
  49. 0 31
      frontend/views/site/resetPassword.php
  50. 0 35
      frontend/views/site/signup.php
  51. 0 2
      frontend/web/.gitignore
  52. 0 2
      frontend/web/assets/.gitignore
  53. 0 120
      frontend/web/css/site.css
  54. BIN
      frontend/web/favicon.ico
  55. 0 15
      frontend/web/index.php
  56. 0 10
      frontend/web/test.php
  57. 1 1
      frontendEle/src/views/dashboard/index.vue
  58. 0 2
      vagrant/config/.gitignore
  59. 0 22
      vagrant/config/vagrant-local.example.yml
  60. 0 77
      vagrant/nginx/app.conf
  61. 0 5
      vagrant/nginx/log/.gitignore
  62. 0 12
      vagrant/provision/always-as-root.sh
  63. 0 9
      vagrant/provision/common.sh
  64. 0 65
      vagrant/provision/once-as-root.sh
  65. 0 32
      vagrant/provision/once-as-vagrant.sh

+ 1 - 25
README.md

@@ -36,30 +36,6 @@ console
     migrations/          contains database migrations
     models/              contains console-specific model classes
     runtime/             contains files generated during runtime
-backend
-    assets/              contains application assets such as JavaScript and CSS
-    config/              contains backend configurations
-    controllers/         contains Web controller classes
-    models/              contains backend-specific model classes
-    runtime/             contains files generated during runtime
-    tests/               contains tests for backend application    
-    views/               contains view files for the Web application
-    web/                 contains the entry script and Web resources
-frontend
-    assets/              contains application assets such as JavaScript and CSS
-    config/              contains frontend configurations
-    controllers/         contains Web controller classes
-    models/              contains frontend-specific model classes
-    runtime/             contains files generated during runtime
-    tests/               contains tests for frontend application
-    views/               contains view files for the Web application
-    web/                 contains the entry script and Web resources
-    widgets/             contains frontend widgets
 vendor/                  contains dependent 3rd-party packages
 environments/            contains environment-based overrides
-```
-
-注意事项
--------------------
-1. 后台新增功能需考虑permission,有权限的才显示
-2. 增删字段要同时修改相应的导出功能
+```

+ 0 - 77
Vagrantfile

@@ -1,77 +0,0 @@
-require 'yaml'
-require 'fileutils'
-
-required_plugins = %w( vagrant-hostmanager vagrant-vbguest )
-required_plugins.each do |plugin|
-    exec "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
-end
-
-domains = {
-  frontend: 'y2aa-frontend.test',
-  backend:  'y2aa-backend.test'
-}
-
-config = {
-  local: './vagrant/config/vagrant-local.yml',
-  example: './vagrant/config/vagrant-local.example.yml'
-}
-
-# copy config from example if local config not exists
-FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local])
-# read config
-options = YAML.load_file config[:local]
-
-# check github token
-if options['github_token'].nil? || options['github_token'].to_s.length != 40
-  puts "You must place REAL GitHub token into configuration:\n/yii2-app-advanced/vagrant/config/vagrant-local.yml"
-  exit
-end
-
-# vagrant configurate
-Vagrant.configure(2) do |config|
-  # select the box
-  config.vm.box = 'bento/ubuntu-16.04'
-
-  # should we ask about box updates?
-  config.vm.box_check_update = options['box_check_update']
-
-  config.vm.provider 'virtualbox' do |vb|
-    # machine cpus count
-    vb.cpus = options['cpus']
-    # machine memory size
-    vb.memory = options['memory']
-    # machine name (for VirtualBox UI)
-    vb.name = options['machine_name']
-  end
-
-  # machine name (for vagrant console)
-  config.vm.define options['machine_name']
-
-  # machine name (for guest machine console)
-  config.vm.hostname = options['machine_name']
-
-  # network settings
-  config.vm.network 'private_network', ip: options['ip']
-
-  # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine)
-  config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant'
-
-  # disable folder '/vagrant' (guest machine)
-  config.vm.synced_folder '.', '/vagrant', disabled: true
-
-  # hosts settings (host machine)
-  config.vm.provision :hostmanager
-  config.hostmanager.enabled            = true
-  config.hostmanager.manage_host        = true
-  config.hostmanager.ignore_private_ip  = false
-  config.hostmanager.include_offline    = true
-  config.hostmanager.aliases            = domains.values
-
-  # provisioners
-  config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']]
-  config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false
-  config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always'
-
-  # post-install message (vagrant console)
-  config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}"
-end

+ 0 - 9
codeception.yml

@@ -1,9 +0,0 @@
-# global codeception file to run tests from all apps
-include:
-    - common
-    - frontend
-    - backend
-paths:
-    log: console/runtime/logs
-settings:
-    colors: true

+ 0 - 14
console/config/main.php

@@ -2,7 +2,6 @@
 $params = array_merge(
     require __DIR__ . '/../../common/config/params.php',
     require __DIR__ . '/../../common/config/params-swoole.php',
-//    require __DIR__ . '/../../common/config/params-rpc.php',
     require __DIR__ . '/params.php'
 );
 
@@ -16,16 +15,12 @@ return [
     'aliases' => [
         '@bower' => '@vendor/bower-asset',
         '@npm'   => '@vendor/npm-asset',
-        //'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
     ],
     'controllerMap' => [
         'fixture' => [
             'class' => 'yii\console\controllers\FixtureController',
             'namespace' => 'common\fixtures',
         ],
-//        'swoole_rpc' => [
-//            'class' => 'common\libs\swoole\RPCController',
-//        ],
     ],
     'components' => [
         'log' => [
@@ -41,15 +36,6 @@ return [
                     'maxLogFiles' => 150,
                     'exportInterval' => 1,
                 ],
-                /*[
-                    'class' => 'yii\log\FileTarget',
-                    'levels' => ['error', 'info'],
-                    'logVars'=>[],
-                    'logFile' => '@console/runtime/logs/'.date('Ymd').'.log',
-                    'maxFileSize' => 1024 * 5,
-                    'maxLogFiles' => 150,
-                    'exportInterval' => 1,
-                ],*/
             ],
         ],
     ],

+ 1 - 1
console/config/params.php

@@ -3,6 +3,6 @@ return [
     'adminEmail' => 'admin@example.com',
     'noticeInterval' => [30, 60, 120], // 秒
     'noticeUrl' => [
-        'shopSystem' => 'http://api.anran.leo/users'
+        'shopSystem' => 'http://localhost/users'
     ],
 ];

+ 0 - 23
frontend/assets/AppAsset.php

@@ -1,23 +0,0 @@
-<?php
-
-namespace frontend\assets;
-
-use yii\web\AssetBundle;
-
-/**
- * Main frontend application asset bundle.
- */
-class AppAsset extends AssetBundle
-{
-    public $basePath = '@webroot';
-    public $baseUrl = '@web';
-    public $css = [
-        'css/site.css',
-    ];
-    public $js = [
-    ];
-    public $depends = [
-        'yii\web\YiiAsset',
-        'yii\bootstrap\BootstrapAsset',
-    ];
-}

+ 0 - 15
frontend/codeception.yml

@@ -1,15 +0,0 @@
-namespace: frontend\tests
-actor_suffix: Tester
-paths:
-    tests: tests
-    output: tests/_output
-    data: tests/_data
-    support: tests/_support
-settings:
-    bootstrap: _bootstrap.php
-    colors: true
-    memory_limit: 1024M
-modules:
-    config:
-        Yii2:
-            configFile: 'config/test-local.php'

+ 0 - 3
frontend/config/.gitignore

@@ -1,3 +0,0 @@
-main-local.php
-params-local.php
-test-local.php

+ 0 - 1
frontend/config/bootstrap.php

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

+ 0 - 48
frontend/config/main.php

@@ -1,48 +0,0 @@
-<?php
-$params = array_merge(
-    require __DIR__ . '/../../common/config/params.php',
-    require __DIR__ . '/params.php'
-);
-return [
-    'id' => 'app-frontend',
-    'basePath' => dirname(__DIR__),
-    'bootstrap' => ['log'],
-    'controllerNamespace' => 'frontend\controllers',
-    'components' => [
-        'request' => [
-            'csrfParam' => '_csrf-frontend',
-        ],
-        'user' => [
-            'identityClass' => 'common\models\User',
-            'enableAutoLogin' => true,
-            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
-        ],
-        'session' => [
-            // this is the name of the session cookie used for login on the frontend
-            'name' => 'advanced-frontend',
-            'class' => 'dcb9\redis\Session',
-            'redis' => $mainConfig['sessionRedis'],
-        ],
-        'log' => [
-            'traceLevel' => YII_DEBUG ? 3 : 0,
-            'targets' => [
-                [
-                    'class' => 'yii\log\FileTarget',
-                    'levels' => ['error', 'warning'],
-                ],
-            ],
-        ],
-        'errorHandler' => [
-            'errorAction' => 'site/error',
-        ],
-        /*
-        'urlManager' => [
-            'enablePrettyUrl' => true,
-            'showScriptName' => false,
-            'rules' => [
-            ],
-        ],
-        */
-    ],
-    'params' => $params,
-];

+ 0 - 4
frontend/config/params.php

@@ -1,4 +0,0 @@
-<?php
-return [
-    'adminEmail' => 'admin@example.com',
-];

+ 0 - 12
frontend/config/test.php

@@ -1,12 +0,0 @@
-<?php
-return [
-    'id' => 'app-frontend-tests',
-    'components' => [
-        'assetManager' => [
-            'basePath' => __DIR__ . '/../web/assets',
-        ],
-        'urlManager' => [
-            'showScriptName' => true,
-        ],
-    ],
-];

+ 0 - 220
frontend/controllers/SiteController.php

@@ -1,220 +0,0 @@
-<?php
-namespace frontend\controllers;
-
-use Yii;
-use yii\base\InvalidParamException;
-use yii\web\BadRequestHttpException;
-use yii\web\Controller;
-use yii\filters\VerbFilter;
-use yii\filters\AccessControl;
-use common\models\LoginForm;
-use frontend\models\PasswordResetRequestForm;
-use frontend\models\ResetPasswordForm;
-use frontend\models\SignupForm;
-use frontend\models\ContactForm;
-
-/**
- * Site controller
- */
-class SiteController extends Controller
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function behaviors()
-    {
-        return [
-            'access' => [
-                'class' => AccessControl::className(),
-                'only' => ['logout', 'signup'],
-                'rules' => [
-                    [
-                        'actions' => ['signup'],
-                        'allow' => true,
-                        'roles' => ['?'],
-                    ],
-                    [
-                        '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 mixed
-     */
-    public function actionIndex()
-    {
-        $test = '789';
-        $redis = Yii::$app->cache;
-        $redis->set('test', $test);
-        //Yii::$app->redis->get('test');
-        exit('成功');
-        return $this->render('index');
-    }
-
-    /**
-     * Logs in a user.
-     *
-     * @return mixed
-     */
-    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();
-        } else {
-            $model->password = '';
-
-            return $this->render('login', [
-                'model' => $model,
-            ]);
-        }
-    }
-
-    /**
-     * Logs out the current user.
-     *
-     * @return mixed
-     */
-    public function actionLogout()
-    {
-        Yii::$app->user->logout();
-
-        return $this->goHome();
-    }
-
-    /**
-     * Displays contact page.
-     *
-     * @return mixed
-     */
-    public function actionContact()
-    {
-        $model = new ContactForm();
-        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
-            if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
-                Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
-            } else {
-                Yii::$app->session->setFlash('error', 'There was an error sending your message.');
-            }
-
-            return $this->refresh();
-        } else {
-            return $this->render('contact', [
-                'model' => $model,
-            ]);
-        }
-    }
-
-    /**
-     * Displays about page.
-     *
-     * @return mixed
-     */
-    public function actionAbout()
-    {
-        return $this->render('about');
-    }
-
-    /**
-     * Signs user up.
-     *
-     * @return mixed
-     */
-    public function actionSignup()
-    {
-        $model = new SignupForm();
-        if ($model->load(Yii::$app->request->post())) {
-            if ($user = $model->signup()) {
-                if (Yii::$app->getUser()->login($user)) {
-                    return $this->goHome();
-                }
-            }
-        }
-
-        return $this->render('signup', [
-            'model' => $model,
-        ]);
-    }
-
-    /**
-     * Requests password reset.
-     *
-     * @return mixed
-     */
-    public function actionRequestPasswordReset()
-    {
-        $model = new PasswordResetRequestForm();
-        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
-            if ($model->sendEmail()) {
-                Yii::$app->session->setFlash('success', 'Check your email for further instructions.');
-
-                return $this->goHome();
-            } else {
-                Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for the provided email address.');
-            }
-        }
-
-        return $this->render('requestPasswordResetToken', [
-            'model' => $model,
-        ]);
-    }
-
-    /**
-     * Resets password.
-     *
-     * @param string $token
-     * @return mixed
-     * @throws BadRequestHttpException
-     */
-    public function actionResetPassword($token)
-    {
-        try {
-            $model = new ResetPasswordForm($token);
-        } catch (InvalidParamException $e) {
-            throw new BadRequestHttpException($e->getMessage());
-        }
-
-        if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
-            Yii::$app->session->setFlash('success', 'New password saved.');
-
-            return $this->goHome();
-        }
-
-        return $this->render('resetPassword', [
-            'model' => $model,
-        ]);
-    }
-}

+ 0 - 60
frontend/models/ContactForm.php

@@ -1,60 +0,0 @@
-<?php
-
-namespace frontend\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;
-
-
-    /**
-     * {@inheritdoc}
-     */
-    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'],
-        ];
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    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 email was sent
-     */
-    public function sendEmail($email)
-    {
-        return Yii::$app->mailer->compose()
-            ->setTo($email)
-            ->setFrom([$this->email => $this->name])
-            ->setSubject($this->subject)
-            ->setTextBody($this->body)
-            ->send();
-    }
-}

+ 0 - 68
frontend/models/PasswordResetRequestForm.php

@@ -1,68 +0,0 @@
-<?php
-namespace frontend\models;
-
-use Yii;
-use yii\base\Model;
-use common\models\User;
-
-/**
- * Password reset request form
- */
-class PasswordResetRequestForm extends Model
-{
-    public $email;
-
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            ['email', 'trim'],
-            ['email', 'required'],
-            ['email', 'email'],
-            ['email', 'exist',
-                'targetClass' => '\common\models\User',
-                'filter' => ['status' => User::STATUS_ACTIVE],
-                'message' => 'There is no user with this email address.'
-            ],
-        ];
-    }
-
-    /**
-     * Sends an email with a link, for resetting the password.
-     *
-     * @return bool whether the email was send
-     */
-    public function sendEmail()
-    {
-        /* @var $user User */
-        $user = User::findOne([
-            'status' => User::STATUS_ACTIVE,
-            'email' => $this->email,
-        ]);
-
-        if (!$user) {
-            return false;
-        }
-        
-        if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
-            $user->generatePasswordResetToken();
-            if (!$user->save()) {
-                return false;
-            }
-        }
-
-        return Yii::$app
-            ->mailer
-            ->compose(
-                ['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'],
-                ['user' => $user]
-            )
-            ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
-            ->setTo($this->email)
-            ->setSubject('Password reset for ' . Yii::$app->name)
-            ->send();
-    }
-}

+ 0 - 64
frontend/models/ResetPasswordForm.php

@@ -1,64 +0,0 @@
-<?php
-namespace frontend\models;
-
-use yii\base\Model;
-use yii\base\InvalidParamException;
-use common\models\User;
-
-/**
- * Password reset form
- */
-class ResetPasswordForm extends Model
-{
-    public $password;
-
-    /**
-     * @var \common\models\User
-     */
-    private $_user;
-
-
-    /**
-     * Creates a form model given a token.
-     *
-     * @param string $token
-     * @param array $config name-value pairs that will be used to initialize the object properties
-     * @throws \yii\base\InvalidParamException if token is empty or not valid
-     */
-    public function __construct($token, $config = [])
-    {
-        if (empty($token) || !is_string($token)) {
-            throw new InvalidParamException('Password reset token cannot be blank.');
-        }
-        $this->_user = User::findByPasswordResetToken($token);
-        if (!$this->_user) {
-            throw new InvalidParamException('Wrong password reset token.');
-        }
-        parent::__construct($config);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            ['password', 'required'],
-            ['password', 'string', 'min' => 6],
-        ];
-    }
-
-    /**
-     * Resets password.
-     *
-     * @return bool if password was reset.
-     */
-    public function resetPassword()
-    {
-        $user = $this->_user;
-        $user->setPassword($this->password);
-        $user->removePasswordResetToken();
-
-        return $user->save(false);
-    }
-}

+ 0 - 58
frontend/models/SignupForm.php

@@ -1,58 +0,0 @@
-<?php
-namespace frontend\models;
-
-use yii\base\Model;
-use common\models\User;
-
-/**
- * Signup form
- */
-class SignupForm extends Model
-{
-    public $username;
-    public $email;
-    public $password;
-
-
-    /**
-     * {@inheritdoc}
-     */
-    public function rules()
-    {
-        return [
-            ['username', 'trim'],
-            ['username', 'required'],
-            ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],
-            ['username', 'string', 'min' => 2, 'max' => 255],
-
-            ['email', 'trim'],
-            ['email', 'required'],
-            ['email', 'email'],
-            ['email', 'string', 'max' => 255],
-            ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'],
-
-            ['password', 'required'],
-            ['password', 'string', 'min' => 6],
-        ];
-    }
-
-    /**
-     * Signs user up.
-     *
-     * @return User|null the saved model or null if saving fails
-     */
-    public function signup()
-    {
-        if (!$this->validate()) {
-            return null;
-        }
-        
-        $user = new User();
-        $user->username = $this->username;
-        $user->email = $this->email;
-        $user->setPassword($this->password);
-        $user->generateAuthKey();
-        
-        return $user->save() ? $user : null;
-    }
-}

+ 0 - 2
frontend/runtime/.gitignore

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

+ 0 - 9
frontend/tests/_bootstrap.php

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

+ 0 - 13
frontend/tests/_data/login_data.php

@@ -1,13 +0,0 @@
-<?php
-return [
-    [
-        'username' => 'erau',
-        'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI',
-        // password_0
-        'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne',
-        'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490',
-        'created_at' => '1392559490',
-        'updated_at' => '1392559490',
-        'email' => 'sfriesen@jenkins.info',
-    ],
-];

+ 0 - 23
frontend/tests/_data/user.php

@@ -1,23 +0,0 @@
-<?php
-
-return [
-    [
-        'username' => 'okirlin',
-        'auth_key' => 'iwTNae9t34OmnK6l4vT4IeaTk-YWI2Rv',
-        'password_hash' => '$2y$13$CXT0Rkle1EMJ/c1l5bylL.EylfmQ39O5JlHJVFpNn618OUS1HwaIi',
-        'password_reset_token' => 't5GU9NwpuGYSfb7FEZMAxqtuz2PkEvv_' . time(),
-        'created_at' => '1391885313',
-        'updated_at' => '1391885313',
-        'email' => 'brady.renner@rutherford.com',
-    ],
-    [
-        'username' => 'troy.becker',
-        'auth_key' => 'EdKfXrx88weFMV0vIxuTMWKgfK2tS3Lp',
-        'password_hash' => '$2y$13$g5nv41Px7VBqhS3hVsVN2.MKfgT3jFdkXEsMC4rQJLfaMa7VaJqL2',
-        'password_reset_token' => '4BSNyiZNAuxjs5Mty990c47sVrgllIi_' . time(),
-        'created_at' => '1391885313',
-        'updated_at' => '1391885313',
-        'email' => 'nicolas.dianna@hotmail.com',
-        'status' => '0',
-    ],
-];

+ 0 - 2
frontend/tests/_output/.gitignore

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

+ 0 - 1
frontend/tests/_support/.gitignore

@@ -1 +0,0 @@
-_generated

+ 0 - 33
frontend/tests/_support/FunctionalTester.php

@@ -1,33 +0,0 @@
-<?php
-namespace frontend\tests;
-
-/**
- * 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;
-
-
-    public function seeValidationError($message)
-    {
-        $this->see($message, '.help-block');
-    }
-
-    public function dontSeeValidationError($message)
-    {
-        $this->dontSee($message, '.help-block');
-    }
-}

+ 0 - 25
frontend/tests/_support/UnitTester.php

@@ -1,25 +0,0 @@
-<?php
-namespace frontend\tests;
-
-/**
- * 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 - 9
frontend/tests/acceptance.suite.yml.example

@@ -1,9 +0,0 @@
-suite_namespace: frontend\tests\acceptance
-actor: AcceptanceTester
-modules:
-    enabled:
-        - WebDriver:
-            url: http://localhost:8080
-            browser: firefox
-        - Yii2:
-            part: init

+ 0 - 20
frontend/tests/acceptance/HomeCest.php

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

+ 0 - 16
frontend/tests/acceptance/_bootstrap.php

@@ -1,16 +0,0 @@
-<?php
-/**
- * Here you can initialize variables via \Codeception\Util\Fixtures class
- * to store data in global array and use it in Cepts.
- *
- * ```php
- * // Here _bootstrap.php
- * \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
- * ```
- *
- * In Cept
- *
- * ```php
- * \Codeception\Util\Fixtures::get('user1');
- * ```
- */

+ 0 - 6
frontend/tests/functional.suite.yml

@@ -1,6 +0,0 @@
-suite_namespace: frontend\tests\functional
-actor: FunctionalTester
-modules:
-    enabled:
-        - Filesystem
-        - Yii2

+ 0 - 13
frontend/tests/functional/AboutCest.php

@@ -1,13 +0,0 @@
-<?php
-namespace frontend\tests\functional;
-
-use frontend\tests\FunctionalTester;
-
-class AboutCest
-{
-    public function checkAbout(FunctionalTester $I)
-    {
-        $I->amOnRoute('site/about');
-        $I->see('About', 'h1');
-    }
-}

+ 0 - 59
frontend/tests/functional/ContactCest.php

@@ -1,59 +0,0 @@
-<?php
-namespace frontend\tests\functional;
-
-use frontend\tests\FunctionalTester;
-
-/* @var $scenario \Codeception\Scenario */
-
-class ContactCest
-{
-    public function _before(FunctionalTester $I)
-    {
-        $I->amOnPage(['site/contact']);
-    }
-
-    public function checkContact(FunctionalTester $I)
-    {
-        $I->see('Contact', 'h1');
-    }
-
-    public function checkContactSubmitNoData(FunctionalTester $I)
-    {
-        $I->submitForm('#contact-form', []);
-        $I->see('Contact', 'h1');
-        $I->seeValidationError('Name cannot be blank');
-        $I->seeValidationError('Email cannot be blank');
-        $I->seeValidationError('Subject cannot be blank');
-        $I->seeValidationError('Body cannot be blank');
-        $I->seeValidationError('The verification code is incorrect');
-    }
-
-    public function checkContactSubmitNotCorrectEmail(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->seeValidationError('Email is not a valid email address.');
-        $I->dontSeeValidationError('Name cannot be blank');
-        $I->dontSeeValidationError('Subject cannot be blank');
-        $I->dontSeeValidationError('Body cannot be blank');
-        $I->dontSeeValidationError('The verification code is incorrect');
-    }
-
-    public function checkContactSubmitCorrectData(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->see('Thank you for contacting us. We will respond to you as soon as possible.');
-    }
-}

+ 0 - 17
frontend/tests/functional/HomeCest.php

@@ -1,17 +0,0 @@
-<?php
-
-namespace frontend\tests\functional;
-
-use frontend\tests\FunctionalTester;
-
-class HomeCest
-{
-    public function checkOpen(FunctionalTester $I)
-    {
-        $I->amOnPage(\Yii::$app->homeUrl);
-        $I->see('My Application');
-        $I->seeLink('About');
-        $I->click('About');
-        $I->see('This is the About page.');
-    }
-}

+ 0 - 60
frontend/tests/functional/LoginCest.php

@@ -1,60 +0,0 @@
-<?php
-
-namespace frontend\tests\functional;
-
-use frontend\tests\FunctionalTester;
-use common\fixtures\UserFixture;
-
-class LoginCest
-{
-     /**
-      * Load fixtures before db transaction begin
-      * Called in _before()
-      * @see \Codeception\Module\Yii2::_before()
-      * @see \Codeception\Module\Yii2::loadFixtures()
-      * @return array
-      */
-    public function _fixtures()
-    {
-        return [
-            'user' => [
-                'class' => UserFixture::className(),
-                'dataFile' => codecept_data_dir() . 'login_data.php'
-            ]
-        ];
-    }
-
-    public function _before(FunctionalTester $I)
-    {
-        $I->amOnRoute('site/login');
-    }
-
-    protected function formParams($login, $password)
-    {
-        return [
-            'LoginForm[username]' => $login,
-            'LoginForm[password]' => $password,
-        ];
-    }
-
-    public function checkEmpty(FunctionalTester $I)
-    {
-        $I->submitForm('#login-form', $this->formParams('', ''));
-        $I->seeValidationError('Username cannot be blank.');
-        $I->seeValidationError('Password cannot be blank.');
-    }
-
-    public function checkWrongPassword(FunctionalTester $I)
-    {
-        $I->submitForm('#login-form', $this->formParams('admin', 'wrong'));
-        $I->seeValidationError('Incorrect username or password.');
-    }
-    
-    public function checkValidLogin(FunctionalTester $I)
-    {
-        $I->submitForm('#login-form', $this->formParams('erau', 'password_0'));
-        $I->see('Logout (erau)', 'form button[type=submit]');
-        $I->dontSeeLink('Login');
-        $I->dontSeeLink('Signup');
-    }
-}

+ 0 - 57
frontend/tests/functional/SignupCest.php

@@ -1,57 +0,0 @@
-<?php
-
-namespace frontend\tests\functional;
-
-use frontend\tests\FunctionalTester;
-
-class SignupCest
-{
-    protected $formId = '#form-signup';
-
-
-    public function _before(FunctionalTester $I)
-    {
-        $I->amOnRoute('site/signup');
-    }
-
-    public function signupWithEmptyFields(FunctionalTester $I)
-    {
-        $I->see('Signup', 'h1');
-        $I->see('Please fill out the following fields to signup:');
-        $I->submitForm($this->formId, []);
-        $I->seeValidationError('Username cannot be blank.');
-        $I->seeValidationError('Email cannot be blank.');
-        $I->seeValidationError('Password cannot be blank.');
-
-    }
-
-    public function signupWithWrongEmail(FunctionalTester $I)
-    {
-        $I->submitForm(
-            $this->formId, [
-            'SignupForm[username]'  => 'tester',
-            'SignupForm[email]'     => 'ttttt',
-            'SignupForm[password]'  => 'tester_password',
-        ]
-        );
-        $I->dontSee('Username cannot be blank.', '.help-block');
-        $I->dontSee('Password cannot be blank.', '.help-block');
-        $I->see('Email is not a valid email address.', '.help-block');
-    }
-
-    public function signupSuccessfully(FunctionalTester $I)
-    {
-        $I->submitForm($this->formId, [
-            'SignupForm[username]' => 'tester',
-            'SignupForm[email]' => 'tester.email@example.com',
-            'SignupForm[password]' => 'tester_password',
-        ]);
-
-        $I->seeRecord('common\models\User', [
-            'username' => 'tester',
-            'email' => 'tester.email@example.com',
-        ]);
-
-        $I->see('Logout (tester)', 'form button[type=submit]');
-    }
-}

+ 0 - 16
frontend/tests/functional/_bootstrap.php

@@ -1,16 +0,0 @@
-<?php
-/**
- * Here you can initialize variables via \Codeception\Util\Fixtures class
- * to store data in global array and use it in Cests.
- *
- * ```php
- * // Here _bootstrap.php
- * \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
- * ```
- *
- * In Cests
- *
- * ```php
- * \Codeception\Util\Fixtures::get('user1');
- * ```
- */

+ 0 - 7
frontend/tests/unit.suite.yml

@@ -1,7 +0,0 @@
-suite_namespace: frontend\tests\unit
-actor: UnitTester
-modules:
-    enabled:
-        - Yii2:
-            part: [orm, email, fixtures]
-        - Asserts

+ 0 - 16
frontend/tests/unit/_bootstrap.php

@@ -1,16 +0,0 @@
-<?php
-/**
- * Here you can initialize variables via \Codeception\Util\Fixtures class
- * to store data in global array and use it in Tests.
- *
- * ```php
- * // Here _bootstrap.php
- * \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
- * ```
- *
- * In Tests
- *
- * ```php
- * \Codeception\Util\Fixtures::get('user1');
- * ```
- */

+ 0 - 32
frontend/tests/unit/models/ContactFormTest.php

@@ -1,32 +0,0 @@
-<?php
-namespace frontend\tests\unit\models;
-
-use Yii;
-use frontend\models\ContactForm;
-
-class ContactFormTest extends \Codeception\Test\Unit
-{
-    public function testSendEmail()
-    {
-        $model = new ContactForm();
-
-        $model->attributes = [
-            'name' => 'Tester',
-            'email' => 'tester@example.com',
-            'subject' => 'very important letter subject',
-            'body' => 'body of current message',
-        ];
-
-        expect_that($model->sendEmail('admin@example.com'));
-
-        // using Yii2 module actions to check email was sent
-        $this->tester->seeEmailIsSent();
-
-        $emailMessage = $this->tester->grabLastSentEmail();
-        expect('valid email is sent', $emailMessage)->isInstanceOf('yii\mail\MessageInterface');
-        expect($emailMessage->getTo())->hasKey('admin@example.com');
-        expect($emailMessage->getFrom())->hasKey('tester@example.com');
-        expect($emailMessage->getSubject())->equals('very important letter subject');
-        expect($emailMessage->toString())->contains('body of current message');
-    }
-}

+ 0 - 59
frontend/tests/unit/models/PasswordResetRequestFormTest.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace frontend\tests\unit\models;
-
-use Yii;
-use frontend\models\PasswordResetRequestForm;
-use common\fixtures\UserFixture as UserFixture;
-use common\models\User;
-
-class PasswordResetRequestFormTest extends \Codeception\Test\Unit
-{
-    /**
-     * @var \frontend\tests\UnitTester
-     */
-    protected $tester;
-
-
-    public function _before()
-    {
-        $this->tester->haveFixtures([
-            'user' => [
-                'class' => UserFixture::className(),
-                'dataFile' => codecept_data_dir() . 'user.php'
-            ]
-        ]);
-    }
-
-    public function testSendMessageWithWrongEmailAddress()
-    {
-        $model = new PasswordResetRequestForm();
-        $model->email = 'not-existing-email@example.com';
-        expect_not($model->sendEmail());
-    }
-
-    public function testNotSendEmailsToInactiveUser()
-    {
-        $user = $this->tester->grabFixture('user', 1);
-        $model = new PasswordResetRequestForm();
-        $model->email = $user['email'];
-        expect_not($model->sendEmail());
-    }
-
-    public function testSendEmailSuccessfully()
-    {
-        $userFixture = $this->tester->grabFixture('user', 0);
-        
-        $model = new PasswordResetRequestForm();
-        $model->email = $userFixture['email'];
-        $user = User::findOne(['password_reset_token' => $userFixture['password_reset_token']]);
-
-        expect_that($model->sendEmail());
-        expect_that($user->password_reset_token);
-
-        $emailMessage = $this->tester->grabLastSentEmail();
-        expect('valid email is sent', $emailMessage)->isInstanceOf('yii\mail\MessageInterface');
-        expect($emailMessage->getTo())->hasKey($model->email);
-        expect($emailMessage->getFrom())->hasKey(Yii::$app->params['supportEmail']);
-    }
-}

+ 0 - 44
frontend/tests/unit/models/ResetPasswordFormTest.php

@@ -1,44 +0,0 @@
-<?php
-
-namespace frontend\tests\unit\models;
-
-use common\fixtures\UserFixture;
-use frontend\models\ResetPasswordForm;
-
-class ResetPasswordFormTest extends \Codeception\Test\Unit
-{
-    /**
-     * @var \frontend\tests\UnitTester
-     */
-    protected $tester;
-
-
-    public function _before()
-    {
-        $this->tester->haveFixtures([
-            'user' => [
-                'class' => UserFixture::className(),
-                'dataFile' => codecept_data_dir() . 'user.php'
-            ],
-        ]);
-    }
-
-    public function testResetWrongToken()
-    {
-        $this->tester->expectException('yii\base\InvalidParamException', function() {
-            new ResetPasswordForm('');
-        });
-
-        $this->tester->expectException('yii\base\InvalidParamException', function() {
-            new ResetPasswordForm('notexistingtoken_1391882543');
-        });
-    }
-
-    public function testResetCorrectToken()
-    {
-        $user = $this->tester->grabFixture('user', 0);
-        $form = new ResetPasswordForm($user['password_reset_token']);
-        expect_that($form->resetPassword());
-    }
-
-}

+ 0 - 59
frontend/tests/unit/models/SignupFormTest.php

@@ -1,59 +0,0 @@
-<?php
-namespace frontend\tests\unit\models;
-
-use common\fixtures\UserFixture;
-use frontend\models\SignupForm;
-
-class SignupFormTest extends \Codeception\Test\Unit
-{
-    /**
-     * @var \frontend\tests\UnitTester
-     */
-    protected $tester;
-
-
-    public function _before()
-    {
-        $this->tester->haveFixtures([
-            'user' => [
-                'class' => UserFixture::className(),
-                'dataFile' => codecept_data_dir() . 'user.php'
-            ]
-        ]);
-    }
-
-    public function testCorrectSignup()
-    {
-        $model = new SignupForm([
-            'username' => 'some_username',
-            'email' => 'some_email@example.com',
-            'password' => 'some_password',
-        ]);
-
-        $user = $model->signup();
-
-        expect($user)->isInstanceOf('common\models\User');
-
-        expect($user->username)->equals('some_username');
-        expect($user->email)->equals('some_email@example.com');
-        expect($user->validatePassword('some_password'))->true();
-    }
-
-    public function testNotCorrectSignup()
-    {
-        $model = new SignupForm([
-            'username' => 'troy.becker',
-            'email' => 'nicolas.dianna@hotmail.com',
-            'password' => 'some_password',
-        ]);
-
-        expect_not($model->signup());
-        expect_that($model->getErrors('username'));
-        expect_that($model->getErrors('email'));
-
-        expect($model->getFirstError('username'))
-            ->equals('This username has already been taken.');
-        expect($model->getFirstError('email'))
-            ->equals('This email address has already been taken.');
-    }
-}

+ 0 - 83
frontend/views/layouts/main.php

@@ -1,83 +0,0 @@
-<?php
-
-/* @var $this \yii\web\View */
-/* @var $content string */
-
-use yii\helpers\Html;
-use yii\bootstrap\Nav;
-use yii\bootstrap\NavBar;
-use yii\widgets\Breadcrumbs;
-use frontend\assets\AppAsset;
-use common\widgets\Alert;
-
-AppAsset::register($this);
-?>
-<?php $this->beginPage() ?>
-<!DOCTYPE html>
-<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>
-    <?php $this->head() ?>
-</head>
-<body>
-<?php $this->beginBody() ?>
-
-<div class="wrap">
-    <?php
-    NavBar::begin([
-        'brandLabel' => Yii::$app->name,
-        'brandUrl' => Yii::$app->homeUrl,
-        'options' => [
-            'class' => 'navbar-inverse navbar-fixed-top',
-        ],
-    ]);
-    $menuItems = [
-        ['label' => 'Home', 'url' => ['/site/index']],
-        ['label' => 'About', 'url' => ['/site/about']],
-        ['label' => 'Contact', 'url' => ['/site/contact']],
-    ];
-    if (Yii::$app->user->isGuest) {
-        $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
-        $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
-    } else {
-        $menuItems[] = '<li>'
-            . Html::beginForm(['/site/logout'], 'post')
-            . Html::submitButton(
-                'Logout (' . Yii::$app->user->identity->username . ')',
-                ['class' => 'btn btn-link logout']
-            )
-            . Html::endForm()
-            . '</li>';
-    }
-    echo Nav::widget([
-        'options' => ['class' => 'navbar-nav navbar-right'],
-        'items' => $menuItems,
-    ]);
-    NavBar::end();
-    ?>
-
-    <div class="container">
-        <?= Breadcrumbs::widget([
-            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
-        ]) ?>
-        <?= Alert::widget() ?>
-        <?= $content ?>
-    </div>
-</div>
-
-<footer class="footer">
-    <div class="container">
-        <p class="pull-left">&copy; <?= Html::encode(Yii::$app->name) ?> <?= date('Y') ?></p>
-
-        <p class="pull-right"><?= Yii::powered() ?></p>
-    </div>
-</footer>
-
-<?php $this->endBody() ?>
-</body>
-</html>
-<?php $this->endPage() ?>

+ 0 - 16
frontend/views/site/about.php

@@ -1,16 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-
-use yii\helpers\Html;
-
-$this->title = 'About';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="site-about">
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>This is the About page. You may modify the following file to customize its content:</p>
-
-    <code><?= __FILE__ ?></code>
-</div>

+ 0 - 45
frontend/views/site/contact.php

@@ -1,45 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-/* @var $form yii\bootstrap\ActiveForm */
-/* @var $model \frontend\models\ContactForm */
-
-use yii\helpers\Html;
-use yii\bootstrap\ActiveForm;
-use yii\captcha\Captcha;
-
-$this->title = 'Contact';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="site-contact">
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>
-        If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
-    </p>
-
-    <div class="row">
-        <div class="col-lg-5">
-            <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
-
-                <?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>
-
-                <?= $form->field($model, 'email') ?>
-
-                <?= $form->field($model, 'subject') ?>
-
-                <?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>
-
-                <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
-                    'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
-                ]) ?>
-
-                <div class="form-group">
-                    <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
-                </div>
-
-            <?php ActiveForm::end(); ?>
-        </div>
-    </div>
-
-</div>

+ 0 - 27
frontend/views/site/error.php

@@ -1,27 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-/* @var $name string */
-/* @var $message string */
-/* @var $exception Exception */
-
-use yii\helpers\Html;
-
-$this->title = $name;
-?>
-<div class="site-error">
-
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <div class="alert alert-danger">
-        <?= nl2br(Html::encode($message)) ?>
-    </div>
-
-    <p>
-        The above error occurred while the Web server was processing your request.
-    </p>
-    <p>
-        Please contact us if you think this is a server error. Thank you.
-    </p>
-
-</div>

+ 0 - 53
frontend/views/site/index.php

@@ -1,53 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-
-$this->title = 'My Yii Application';
-?>
-<div class="site-index">
-
-    <div class="jumbotron">
-        <h1>Congratulations!</h1>
-
-        <p class="lead">You have successfully created your Yii-powered application.</p>
-
-        <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
-    </div>
-
-    <div class="body-content">
-
-        <div class="row">
-            <div class="col-lg-4">
-                <h2>Heading</h2>
-
-                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
-                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
-                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
-                    fugiat nulla pariatur.</p>
-
-                <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
-            </div>
-            <div class="col-lg-4">
-                <h2>Heading</h2>
-
-                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
-                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
-                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
-                    fugiat nulla pariatur.</p>
-
-                <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
-            </div>
-            <div class="col-lg-4">
-                <h2>Heading</h2>
-
-                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
-                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
-                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
-                    fugiat nulla pariatur.</p>
-
-                <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
-            </div>
-        </div>
-
-    </div>
-</div>

+ 0 - 39
frontend/views/site/login.php

@@ -1,39 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-/* @var $form yii\bootstrap\ActiveForm */
-/* @var $model \common\models\LoginForm */
-
-use yii\helpers\Html;
-use yii\bootstrap\ActiveForm;
-
-$this->title = 'Login';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="site-login">
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>Please fill out the following fields to login:</p>
-
-    <div class="row">
-        <div class="col-lg-5">
-            <?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
-
-                <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
-
-                <?= $form->field($model, 'password')->passwordInput() ?>
-
-                <?= $form->field($model, 'rememberMe')->checkbox() ?>
-
-                <div style="color:#999;margin:1em 0">
-                    If you forgot your password you can <?= Html::a('reset it', ['site/request-password-reset']) ?>.
-                </div>
-
-                <div class="form-group">
-                    <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
-                </div>
-
-            <?php ActiveForm::end(); ?>
-        </div>
-    </div>
-</div>

+ 0 - 31
frontend/views/site/requestPasswordResetToken.php

@@ -1,31 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-/* @var $form yii\bootstrap\ActiveForm */
-/* @var $model \frontend\models\PasswordResetRequestForm */
-
-use yii\helpers\Html;
-use yii\bootstrap\ActiveForm;
-
-$this->title = 'Request password reset';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="site-request-password-reset">
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>Please fill out your email. A link to reset password will be sent there.</p>
-
-    <div class="row">
-        <div class="col-lg-5">
-            <?php $form = ActiveForm::begin(['id' => 'request-password-reset-form']); ?>
-
-                <?= $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
-
-                <div class="form-group">
-                    <?= Html::submitButton('Send', ['class' => 'btn btn-primary']) ?>
-                </div>
-
-            <?php ActiveForm::end(); ?>
-        </div>
-    </div>
-</div>

+ 0 - 31
frontend/views/site/resetPassword.php

@@ -1,31 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-/* @var $form yii\bootstrap\ActiveForm */
-/* @var $model \frontend\models\ResetPasswordForm */
-
-use yii\helpers\Html;
-use yii\bootstrap\ActiveForm;
-
-$this->title = 'Reset password';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="site-reset-password">
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>Please choose your new password:</p>
-
-    <div class="row">
-        <div class="col-lg-5">
-            <?php $form = ActiveForm::begin(['id' => 'reset-password-form']); ?>
-
-                <?= $form->field($model, 'password')->passwordInput(['autofocus' => true]) ?>
-
-                <div class="form-group">
-                    <?= Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
-                </div>
-
-            <?php ActiveForm::end(); ?>
-        </div>
-    </div>
-</div>

+ 0 - 35
frontend/views/site/signup.php

@@ -1,35 +0,0 @@
-<?php
-
-/* @var $this yii\web\View */
-/* @var $form yii\bootstrap\ActiveForm */
-/* @var $model \frontend\models\SignupForm */
-
-use yii\helpers\Html;
-use yii\bootstrap\ActiveForm;
-
-$this->title = 'Signup';
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="site-signup">
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>Please fill out the following fields to signup:</p>
-
-    <div class="row">
-        <div class="col-lg-5">
-            <?php $form = ActiveForm::begin(['id' => 'form-signup']); ?>
-
-                <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
-
-                <?= $form->field($model, 'email') ?>
-
-                <?= $form->field($model, 'password')->passwordInput() ?>
-
-                <div class="form-group">
-                    <?= Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
-                </div>
-
-            <?php ActiveForm::end(); ?>
-        </div>
-    </div>
-</div>

+ 0 - 2
frontend/web/.gitignore

@@ -1,2 +0,0 @@
-/index-test.php
-/robots.txt

+ 0 - 2
frontend/web/assets/.gitignore

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

+ 0 - 120
frontend/web/css/site.css

@@ -1,120 +0,0 @@
-html,
-body {
-    height: 100%;
-}
-
-.wrap {
-    min-height: 100%;
-    height: auto;
-    margin: 0 auto -60px;
-    padding: 0 0 60px;
-}
-
-.wrap > .container {
-    padding: 70px 15px 20px;
-}
-
-.footer {
-    height: 60px;
-    background-color: #f5f5f5;
-    border-top: 1px solid #ddd;
-    padding-top: 20px;
-}
-
-.jumbotron {
-    text-align: center;
-    background-color: transparent;
-}
-
-.jumbotron .btn {
-    font-size: 21px;
-    padding: 14px 24px;
-}
-
-.not-set {
-    color: #c55;
-    font-style: italic;
-}
-
-/* add sorting icons to gridview sort links */
-a.asc:after, a.desc:after {
-    position: relative;
-    top: 1px;
-    display: inline-block;
-    font-family: 'Glyphicons Halflings';
-    font-style: normal;
-    font-weight: normal;
-    line-height: 1;
-    padding-left: 5px;
-}
-
-a.asc:after {
-    content: "\e151";
-}
-
-a.desc:after {
-    content: "\e152";
-}
-
-.sort-numerical a.asc:after {
-    content: "\e153";
-}
-
-.sort-numerical a.desc:after {
-    content: "\e154";
-}
-
-.sort-ordinal a.asc:after {
-    content: "\e155";
-}
-
-.sort-ordinal a.desc:after {
-    content: "\e156";
-}
-
-.grid-view td {
-    white-space: nowrap;
-}
-
-.grid-view .filters input,
-.grid-view .filters select {
-    min-width: 50px;
-}
-
-.hint-block {
-    display: block;
-    margin-top: 5px;
-    color: #999;
-}
-
-.error-summary {
-    color: #a94442;
-    background: #fdf7f7;
-    border-left: 3px solid #eed3d7;
-    padding: 10px 20px;
-    margin: 0 0 15px 0;
-}
-
-/* align the logout "link" (button in form) of the navbar */
-.nav li > form > button.logout {
-    padding: 15px;
-    border: none;
-}
-
-@media(max-width:767px) {
-    .nav li > form > button.logout {
-        display:block;
-        text-align: left;
-        width: 100%;
-        padding: 10px 15px;
-    }
-}
-
-.nav > li > form > button.logout:focus,
-.nav > li > form > button.logout:hover {
-    text-decoration: none;
-}
-
-.nav > li > form > button.logout:focus {
-    outline: none;
-}

BIN
frontend/web/favicon.ico


+ 0 - 15
frontend/web/index.php

@@ -1,15 +0,0 @@
-<?php
-defined('YII_DEBUG') or define('YII_DEBUG', true);
-defined('YII_ENV') or define('YII_ENV', 'dev');
-
-require __DIR__ . '/../../vendor/autoload.php';
-require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
-require __DIR__ . '/../../common/config/bootstrap.php';
-require __DIR__ . '/../config/bootstrap.php';
-
-$config = yii\helpers\ArrayHelper::merge(
-    require __DIR__ . '/../../common/config/main.php',
-    require __DIR__ . '/../config/main.php'
-);
-
-(new yii\web\Application($config))->run();

+ 0 - 10
frontend/web/test.php

@@ -1,10 +0,0 @@
-<?php
-phpinfo();
-
-//$redis = new Redis();
-//$con = $redis->connect('192.168.0.196', 6379);
-//$redis->auth('123456');
-//$redis->select(1);
-//$redis->set('test1', 'abc');
-//exit('123');
-

+ 1 - 1
frontendEle/src/views/dashboard/index.vue

@@ -116,7 +116,7 @@
         news: [],
         periodNum: '',
         decLvName: '',
-        bannerHeight: '',
+        bannerHeight: ''
       }
     },
     computed: {

+ 0 - 2
vagrant/config/.gitignore

@@ -1,2 +0,0 @@
-# local configuration
-vagrant-local.yml

+ 0 - 22
vagrant/config/vagrant-local.example.yml

@@ -1,22 +0,0 @@
-# Your personal GitHub token
-github_token: <your-personal-github-token>
-# Read more: https://github.com/blog/1509-personal-api-tokens
-# You can generate it here: https://github.com/settings/tokens
-
-# Guest OS timezone
-timezone: Europe/London
-
-# Are we need check box updates for every 'vagrant up'?
-box_check_update: false
-
-# Virtual machine name
-machine_name: y2aa
-
-# Virtual machine IP
-ip: 192.168.83.137
-
-# Virtual machine CPU cores number
-cpus: 1
-
-# Virtual machine RAM
-memory: 1024

+ 0 - 77
vagrant/nginx/app.conf

@@ -1,77 +0,0 @@
-server {
-   charset utf-8;
-   client_max_body_size 128M;
-   sendfile off;
-
-   listen 80; ## listen for ipv4
-   #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
-
-   server_name y2aa-frontend.test;
-   root        /app/frontend/web/;
-   index       index.php;
-
-   access_log  /app/vagrant/nginx/log/frontend-access.log;
-   error_log   /app/vagrant/nginx/log/frontend-error.log;
-
-   location / {
-       # Redirect everything that isn't a real file to index.php
-       try_files $uri $uri/ /index.php$is_args$args;
-   }
-
-   # uncomment to avoid processing of calls to non-existing static files by Yii
-   #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
-   #    try_files $uri =404;
-   #}
-   #error_page 404 /404.html;
-
-   location ~ \.php$ {
-       include fastcgi_params;
-       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-       #fastcgi_pass   127.0.0.1:9000;
-       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
-       try_files $uri =404;
-   }
-
-   location ~ /\.(ht|svn|git) {
-       deny all;
-   }
-}
-
-server {
-   charset utf-8;
-   client_max_body_size 128M;
-   sendfile off;
-
-   listen 80; ## listen for ipv4
-   #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
-
-   server_name y2aa-backend.test;
-   root        /app/backend/web/;
-   index       index.php;
-
-   access_log  /app/vagrant/nginx/log/backend-access.log;
-   error_log   /app/vagrant/nginx/log/backend-error.log;
-
-   location / {
-       # Redirect everything that isn't a real file to index.php
-       try_files $uri $uri/ /index.php$is_args$args;
-   }
-
-   # uncomment to avoid processing of calls to non-existing static files by Yii
-   #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
-   #    try_files $uri =404;
-   #}
-   #error_page 404 /404.html;
-
-   location ~ \.php$ {
-       include fastcgi_params;
-       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-       #fastcgi_pass   127.0.0.1:9000;
-       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
-       try_files $uri =404;
-   }
-
-   location ~ /\.(ht|svn|git) {
-       deny all;
-   }
-}

+ 0 - 5
vagrant/nginx/log/.gitignore

@@ -1,5 +0,0 @@
-# nginx logs
-backend-access.log
-backend-error.log
-frontend-access.log
-frontend-error.log

+ 0 - 12
vagrant/provision/always-as-root.sh

@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-source /app/vagrant/provision/common.sh
-
-#== Provision script ==
-
-info "Provision-script user: `whoami`"
-
-info "Restart web-stack"
-service php7.0-fpm restart
-service nginx restart
-service mysql restart

+ 0 - 9
vagrant/provision/common.sh

@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-
-#== Bash helpers ==
-
-function info {
-  echo " "
-  echo "--> $1"
-  echo " "
-}

+ 0 - 65
vagrant/provision/once-as-root.sh

@@ -1,65 +0,0 @@
-#!/usr/bin/env bash
-
-source /app/vagrant/provision/common.sh
-
-#== Import script args ==
-
-timezone=$(echo "$1")
-
-#== Provision script ==
-
-info "Provision-script user: `whoami`"
-
-export DEBIAN_FRONTEND=noninteractive
-
-info "Configure timezone"
-timedatectl set-timezone ${timezone} --no-ask-password
-
-info "Prepare root password for MySQL"
-debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password \"''\""
-debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password \"''\""
-echo "Done!"
-
-info "Update OS software"
-apt-get update
-apt-get upgrade -y
-
-info "Install additional software"
-apt-get install -y php7.0-curl php7.0-cli php7.0-intl php7.0-mysqlnd php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml unzip nginx mysql-server-5.7 php.xdebug
-
-info "Configure MySQL"
-sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
-mysql -uroot <<< "CREATE USER 'root'@'%' IDENTIFIED BY ''"
-mysql -uroot <<< "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'"
-mysql -uroot <<< "DROP USER 'root'@'localhost'"
-mysql -uroot <<< "FLUSH PRIVILEGES"
-echo "Done!"
-
-info "Configure PHP-FPM"
-sed -i 's/user = www-data/user = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf
-sed -i 's/group = www-data/group = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf
-sed -i 's/owner = www-data/owner = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf
-cat << EOF > /etc/php/7.0/mods-available/xdebug.ini
-zend_extension=xdebug.so
-xdebug.remote_enable=1
-xdebug.remote_connect_back=1
-xdebug.remote_port=9000
-xdebug.remote_autostart=1
-EOF
-echo "Done!"
-
-info "Configure NGINX"
-sed -i 's/user www-data/user vagrant/g' /etc/nginx/nginx.conf
-echo "Done!"
-
-info "Enabling site configuration"
-ln -s /app/vagrant/nginx/app.conf /etc/nginx/sites-enabled/app.conf
-echo "Done!"
-
-info "Initailize databases for MySQL"
-mysql -uroot <<< "CREATE DATABASE yii2advanced"
-mysql -uroot <<< "CREATE DATABASE yii2advanced_test"
-echo "Done!"
-
-info "Install composer"
-curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

+ 0 - 32
vagrant/provision/once-as-vagrant.sh

@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-
-source /app/vagrant/provision/common.sh
-
-#== Import script args ==
-
-github_token=$(echo "$1")
-
-#== Provision script ==
-
-info "Provision-script user: `whoami`"
-
-info "Configure composer"
-composer config --global github-oauth.github.com ${github_token}
-echo "Done!"
-
-info "Install project dependencies"
-cd /app
-composer --no-progress --prefer-dist install
-
-info "Init project"
-./init --env=Development --overwrite=y
-
-info "Apply migrations"
-./yii migrate --interactive=0
-./yii_test migrate --interactive=0
-
-info "Create bash-alias 'app' for vagrant user"
-echo 'alias app="cd /app"' | tee /home/vagrant/.bash_aliases
-
-info "Enabling colorized prompt for guest console"
-sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/" /home/vagrant/.bashrc