Commit 5e6d26a9200ce585ad7e49c818c249d9318ff6db

Authored by Yarik
1 parent e9d97c36

RC

common/config/main.php
... ... @@ -26,6 +26,10 @@
26 26 'class' => 'yii\i18n\PhpMessageSource',
27 27 'basePath' => '@artbox/core/messages',
28 28 ],
  29 + 'app' => [
  30 + 'class' => 'yii\i18n\PhpMessageSource',
  31 + 'basePath' => '@common/messages',
  32 + ],
29 33 ],
30 34 ],
31 35 'filedb' => [
... ...
common/images/10_ev0XLXapepq5zp06n3fSDJDRquCsapF0.png deleted

2.32 KB

common/messages/en/app.php 0 → 100755
  1 +<?php
  2 + return [];
0 3 \ No newline at end of file
... ...
common/messages/ru/app.php 0 → 100755
  1 +<?php
  2 + return [];
0 3 \ No newline at end of file
... ...
common/models/LoginForm.php deleted
1   -<?php
2   - namespace common\models;
3   -
4   - use artbox\core\models\User;
5   - use Yii;
6   - use yii\base\Model;
7   -
8   - /**
9   - * Login form
10   - */
11   - class LoginForm extends Model
12   - {
13   - public $username;
14   - public $password;
15   - public $rememberMe = true;
16   -
17   - private $_user;
18   -
19   - /**
20   - * @inheritdoc
21   - */
22   - public function rules()
23   - {
24   - return [
25   - // username and password are both required
26   - [
27   - [
28   - 'username',
29   - 'password',
30   - ],
31   - 'required',
32   - ],
33   - // rememberMe must be a boolean value
34   - [
35   - 'rememberMe',
36   - 'boolean',
37   - ],
38   - // password is validated by validatePassword()
39   - [
40   - 'password',
41   - 'validatePassword',
42   - ],
43   - ];
44   - }
45   -
46   - /**
47   - * Validates the password.
48   - * This method serves as the inline validation for password.
49   - *
50   - * @param string $attribute the attribute currently being validated
51   - * @param array $params the additional name-value pairs given in the rule
52   - */
53   - public function validatePassword($attribute, $params)
54   - {
55   - if (!$this->hasErrors()) {
56   - $user = $this->getUser();
57   - if (!$user || !$user->validatePassword($this->password)) {
58   - $this->addError($attribute, 'Incorrect username or password.');
59   - }
60   - }
61   - }
62   -
63   - /**
64   - * Logs in a user using the provided username and password.
65   - *
66   - * @return bool whether the user is logged in successfully
67   - */
68   - public function login()
69   - {
70   - if ($this->validate()) {
71   - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
72   - } else {
73   - return false;
74   - }
75   - }
76   -
77   - /**
78   - * Finds user by [[username]]
79   - *
80   - * @return User|null
81   - */
82   - protected function getUser()
83   - {
84   - if ($this->_user === null) {
85   - $this->_user = User::findByUsername($this->username);
86   - }
87   -
88   - return $this->_user;
89   - }
90   - }
common/widgets/Alert.php deleted
1   -<?php
2   -namespace common\widgets;
3   -
4   -use Yii;
5   -
6   -/**
7   - * Alert widget renders a message from session flash. All flash messages are displayed
8   - * in the sequence they were assigned using setFlash. You can set message as following:
9   - *
10   - * ```php
11   - * Yii::$app->session->setFlash('error', 'This is the message');
12   - * Yii::$app->session->setFlash('success', 'This is the message');
13   - * Yii::$app->session->setFlash('info', 'This is the message');
14   - * ```
15   - *
16   - * Multiple messages could be set as follows:
17   - *
18   - * ```php
19   - * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']);
20   - * ```
21   - *
22   - * @author Kartik Visweswaran <kartikv2@gmail.com>
23   - * @author Alexander Makarov <sam@rmcreative.ru>
24   - */
25   -class Alert extends \yii\bootstrap\Widget
26   -{
27   - /**
28   - * @var array the alert types configuration for the flash messages.
29   - * This array is setup as $key => $value, where:
30   - * - $key is the name of the session flash variable
31   - * - $value is the bootstrap alert type (i.e. danger, success, info, warning)
32   - */
33   - public $alertTypes = [
34   - 'error' => 'alert-danger',
35   - 'danger' => 'alert-danger',
36   - 'success' => 'alert-success',
37   - 'info' => 'alert-info',
38   - 'warning' => 'alert-warning'
39   - ];
40   - /**
41   - * @var array the options for rendering the close button tag.
42   - */
43   - public $closeButton = [];
44   -
45   -
46   - public function init()
47   - {
48   - parent::init();
49   -
50   - $session = Yii::$app->session;
51   - $flashes = $session->getAllFlashes();
52   - $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : '';
53   -
54   - foreach ($flashes as $type => $data) {
55   - if (isset($this->alertTypes[$type])) {
56   - $data = (array) $data;
57   - foreach ($data as $i => $message) {
58   - /* initialize css class for each alert box */
59   - $this->options['class'] = $this->alertTypes[$type] . $appendCss;
60   -
61   - /* assign unique id to each alert box */
62   - $this->options['id'] = $this->getId() . '-' . $type . '-' . $i;
63   -
64   - echo \yii\bootstrap\Alert::widget([
65   - 'body' => $message,
66   - 'closeButton' => $this->closeButton,
67   - 'options' => $this->options,
68   - ]);
69   - }
70   -
71   - $session->removeFlash($type);
72   - }
73   - }
74   - }
75   -}
frontend/models/ContactForm.php deleted
1   -<?php
2   -
3   -namespace frontend\models;
4   -
5   -use Yii;
6   -use yii\base\Model;
7   -
8   -/**
9   - * ContactForm is the model behind the contact form.
10   - */
11   -class ContactForm extends Model
12   -{
13   - public $name;
14   - public $email;
15   - public $subject;
16   - public $body;
17   - public $verifyCode;
18   -
19   -
20   - /**
21   - * @inheritdoc
22   - */
23   - public function rules()
24   - {
25   - return [
26   - // name, email, subject and body are required
27   - [['name', 'email', 'subject', 'body'], 'required'],
28   - // email has to be a valid email address
29   - ['email', 'email'],
30   - // verifyCode needs to be entered correctly
31   - ['verifyCode', 'captcha'],
32   - ];
33   - }
34   -
35   - /**
36   - * @inheritdoc
37   - */
38   - public function attributeLabels()
39   - {
40   - return [
41   - 'verifyCode' => 'Verification Code',
42   - ];
43   - }
44   -
45   - /**
46   - * Sends an email to the specified email address using the information collected by this model.
47   - *
48   - * @param string $email the target email address
49   - * @return bool whether the email was sent
50   - */
51   - public function sendEmail($email)
52   - {
53   - return Yii::$app->mailer->compose()
54   - ->setTo($email)
55   - ->setFrom([$this->email => $this->name])
56   - ->setSubject($this->subject)
57   - ->setTextBody($this->body)
58   - ->send();
59   - }
60   -}
frontend/models/PasswordResetRequestForm.php deleted
1   -<?php
2   -namespace frontend\models;
3   -
4   -use Yii;
5   -use yii\base\Model;
6   -use common\models\User;
7   -
8   -/**
9   - * Password reset request form
10   - */
11   -class PasswordResetRequestForm extends Model
12   -{
13   - public $email;
14   -
15   -
16   - /**
17   - * @inheritdoc
18   - */
19   - public function rules()
20   - {
21   - return [
22   - ['email', 'trim'],
23   - ['email', 'required'],
24   - ['email', 'email'],
25   - ['email', 'exist',
26   - 'targetClass' => '\common\models\User',
27   - 'filter' => ['status' => User::STATUS_ACTIVE],
28   - 'message' => 'There is no user with this email address.'
29   - ],
30   - ];
31   - }
32   -
33   - /**
34   - * Sends an email with a link, for resetting the password.
35   - *
36   - * @return bool whether the email was send
37   - */
38   - public function sendEmail()
39   - {
40   - /* @var $user User */
41   - $user = User::findOne([
42   - 'status' => User::STATUS_ACTIVE,
43   - 'email' => $this->email,
44   - ]);
45   -
46   - if (!$user) {
47   - return false;
48   - }
49   -
50   - if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
51   - $user->generatePasswordResetToken();
52   - if (!$user->save()) {
53   - return false;
54   - }
55   - }
56   -
57   - return Yii::$app
58   - ->mailer
59   - ->compose(
60   - ['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'],
61   - ['user' => $user]
62   - )
63   - ->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])
64   - ->setTo($this->email)
65   - ->setSubject('Password reset for ' . Yii::$app->name)
66   - ->send();
67   - }
68   -}
frontend/models/ResetPasswordForm.php deleted
1   -<?php
2   -namespace frontend\models;
3   -
4   -use yii\base\Model;
5   -use yii\base\InvalidParamException;
6   -use common\models\User;
7   -
8   -/**
9   - * Password reset form
10   - */
11   -class ResetPasswordForm extends Model
12   -{
13   - public $password;
14   -
15   - /**
16   - * @var \common\models\User
17   - */
18   - private $_user;
19   -
20   -
21   - /**
22   - * Creates a form model given a token.
23   - *
24   - * @param string $token
25   - * @param array $config name-value pairs that will be used to initialize the object properties
26   - * @throws \yii\base\InvalidParamException if token is empty or not valid
27   - */
28   - public function __construct($token, $config = [])
29   - {
30   - if (empty($token) || !is_string($token)) {
31   - throw new InvalidParamException('Password reset token cannot be blank.');
32   - }
33   - $this->_user = User::findByPasswordResetToken($token);
34   - if (!$this->_user) {
35   - throw new InvalidParamException('Wrong password reset token.');
36   - }
37   - parent::__construct($config);
38   - }
39   -
40   - /**
41   - * @inheritdoc
42   - */
43   - public function rules()
44   - {
45   - return [
46   - ['password', 'required'],
47   - ['password', 'string', 'min' => 6],
48   - ];
49   - }
50   -
51   - /**
52   - * Resets password.
53   - *
54   - * @return bool if password was reset.
55   - */
56   - public function resetPassword()
57   - {
58   - $user = $this->_user;
59   - $user->setPassword($this->password);
60   - $user->removePasswordResetToken();
61   -
62   - return $user->save(false);
63   - }
64   -}
frontend/models/SignupForm.php deleted
1   -<?php
2   -namespace frontend\models;
3   -
4   -use yii\base\Model;
5   -use common\models\User;
6   -
7   -/**
8   - * Signup form
9   - */
10   -class SignupForm extends Model
11   -{
12   - public $username;
13   - public $email;
14   - public $password;
15   -
16   -
17   - /**
18   - * @inheritdoc
19   - */
20   - public function rules()
21   - {
22   - return [
23   - ['username', 'trim'],
24   - ['username', 'required'],
25   - ['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],
26   - ['username', 'string', 'min' => 2, 'max' => 255],
27   -
28   - ['email', 'trim'],
29   - ['email', 'required'],
30   - ['email', 'email'],
31   - ['email', 'string', 'max' => 255],
32   - ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'],
33   -
34   - ['password', 'required'],
35   - ['password', 'string', 'min' => 6],
36   - ];
37   - }
38   -
39   - /**
40   - * Signs user up.
41   - *
42   - * @return User|null the saved model or null if saving fails
43   - */
44   - public function signup()
45   - {
46   - if (!$this->validate()) {
47   - return null;
48   - }
49   -
50   - $user = new User();
51   - $user->username = $this->username;
52   - $user->email = $this->email;
53   - $user->setPassword($this->password);
54   - $user->generateAuthKey();
55   -
56   - return $user->save() ? $user : null;
57   - }
58   -}
frontend/views/site/login.php deleted
1   -<?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $form yii\bootstrap\ActiveForm */
5   -/* @var $model \common\models\LoginForm */
6   -
7   -use yii\helpers\Html;
8   -use yii\bootstrap\ActiveForm;
9   -
10   -$this->title = 'Login';
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="site-login">
14   - <h1><?= Html::encode($this->title) ?></h1>
15   -
16   - <p>Please fill out the following fields to login:</p>
17   -
18   - <div class="row">
19   - <div class="col-lg-5">
20   - <?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
21   -
22   - <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
23   -
24   - <?= $form->field($model, 'password')->passwordInput() ?>
25   -
26   - <?= $form->field($model, 'rememberMe')->checkbox() ?>
27   -
28   - <div style="color:#999;margin:1em 0">
29   - If you forgot your password you can <?= Html::a('reset it', ['site/request-password-reset']) ?>.
30   - </div>
31   -
32   - <div class="form-group">
33   - <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
34   - </div>
35   -
36   - <?php ActiveForm::end(); ?>
37   - </div>
38   - </div>
39   -</div>
frontend/views/site/requestPasswordResetToken.php deleted
1   -<?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $form yii\bootstrap\ActiveForm */
5   -/* @var $model \frontend\models\PasswordResetRequestForm */
6   -
7   -use yii\helpers\Html;
8   -use yii\bootstrap\ActiveForm;
9   -
10   -$this->title = 'Request password reset';
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="site-request-password-reset">
14   - <h1><?= Html::encode($this->title) ?></h1>
15   -
16   - <p>Please fill out your email. A link to reset password will be sent there.</p>
17   -
18   - <div class="row">
19   - <div class="col-lg-5">
20   - <?php $form = ActiveForm::begin(['id' => 'request-password-reset-form']); ?>
21   -
22   - <?= $form->field($model, 'email')->textInput(['autofocus' => true]) ?>
23   -
24   - <div class="form-group">
25   - <?= Html::submitButton('Send', ['class' => 'btn btn-primary']) ?>
26   - </div>
27   -
28   - <?php ActiveForm::end(); ?>
29   - </div>
30   - </div>
31   -</div>
frontend/views/site/resetPassword.php deleted
1   -<?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $form yii\bootstrap\ActiveForm */
5   -/* @var $model \frontend\models\ResetPasswordForm */
6   -
7   -use yii\helpers\Html;
8   -use yii\bootstrap\ActiveForm;
9   -
10   -$this->title = 'Reset password';
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="site-reset-password">
14   - <h1><?= Html::encode($this->title) ?></h1>
15   -
16   - <p>Please choose your new password:</p>
17   -
18   - <div class="row">
19   - <div class="col-lg-5">
20   - <?php $form = ActiveForm::begin(['id' => 'reset-password-form']); ?>
21   -
22   - <?= $form->field($model, 'password')->passwordInput(['autofocus' => true]) ?>
23   -
24   - <div class="form-group">
25   - <?= Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
26   - </div>
27   -
28   - <?php ActiveForm::end(); ?>
29   - </div>
30   - </div>
31   -</div>
frontend/views/site/signup.php deleted
1   -<?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $form yii\bootstrap\ActiveForm */
5   -/* @var $model \frontend\models\SignupForm */
6   -
7   -use yii\helpers\Html;
8   -use yii\bootstrap\ActiveForm;
9   -
10   -$this->title = 'Signup';
11   -$this->params['breadcrumbs'][] = $this->title;
12   -?>
13   -<div class="site-signup">
14   - <h1><?= Html::encode($this->title) ?></h1>
15   -
16   - <p>Please fill out the following fields to signup:</p>
17   -
18   - <div class="row">
19   - <div class="col-lg-5">
20   - <?php $form = ActiveForm::begin(['id' => 'form-signup']); ?>
21   -
22   - <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
23   -
24   - <?= $form->field($model, 'email') ?>
25   -
26   - <?= $form->field($model, 'password')->passwordInput() ?>
27   -
28   - <div class="form-group">
29   - <?= Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>
30   - </div>
31   -
32   - <?php ActiveForm::end(); ?>
33   - </div>
34   - </div>
35   -</div>
frontend/web/img/7_bMIj6pnE4WCbYj8XV7jYIc3PmtwqBi_F.png 0 → 100644

159 KB

common/images/9_tNFKzJ9WT0XNsvQT4NhS9gZKfFKmIo5y.jpg renamed to frontend/web/img/8_6cR4qWhyoJXORQG87Vm5K5O5vyq5-0k2.jpg

27.3 KB