diff --git a/common/config/main.php b/common/config/main.php index 05f6896..c8adc95 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -26,6 +26,10 @@ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@artbox/core/messages', ], + 'app' => [ + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => '@common/messages', + ], ], ], 'filedb' => [ diff --git a/common/images/10_ev0XLXapepq5zp06n3fSDJDRquCsapF0.png b/common/images/10_ev0XLXapepq5zp06n3fSDJDRquCsapF0.png deleted file mode 100644 index 9fd4d4a..0000000 Binary files a/common/images/10_ev0XLXapepq5zp06n3fSDJDRquCsapF0.png and /dev/null differ diff --git a/common/images/9_tNFKzJ9WT0XNsvQT4NhS9gZKfFKmIo5y.jpg b/common/images/9_tNFKzJ9WT0XNsvQT4NhS9gZKfFKmIo5y.jpg deleted file mode 100644 index dca89cc..0000000 Binary files a/common/images/9_tNFKzJ9WT0XNsvQT4NhS9gZKfFKmIo5y.jpg and /dev/null differ diff --git a/common/messages/en/app.php b/common/messages/en/app.php new file mode 100755 index 0000000..e3b6834 --- /dev/null +++ b/common/messages/en/app.php @@ -0,0 +1,2 @@ +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); - } else { - return false; - } - } - - /** - * Finds user by [[username]] - * - * @return User|null - */ - protected function getUser() - { - if ($this->_user === null) { - $this->_user = User::findByUsername($this->username); - } - - return $this->_user; - } - } diff --git a/common/widgets/Alert.php b/common/widgets/Alert.php deleted file mode 100644 index 69f1c40..0000000 --- a/common/widgets/Alert.php +++ /dev/null @@ -1,75 +0,0 @@ -session->setFlash('error', 'This is the message'); - * Yii::$app->session->setFlash('success', 'This is the message'); - * Yii::$app->session->setFlash('info', 'This is the message'); - * ``` - * - * Multiple messages could be set as follows: - * - * ```php - * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); - * ``` - * - * @author Kartik Visweswaran - * @author Alexander Makarov - */ -class Alert extends \yii\bootstrap\Widget -{ - /** - * @var array the alert types configuration for the flash messages. - * This array is setup as $key => $value, where: - * - $key is the name of the session flash variable - * - $value is the bootstrap alert type (i.e. danger, success, info, warning) - */ - public $alertTypes = [ - 'error' => 'alert-danger', - 'danger' => 'alert-danger', - 'success' => 'alert-success', - 'info' => 'alert-info', - 'warning' => 'alert-warning' - ]; - /** - * @var array the options for rendering the close button tag. - */ - public $closeButton = []; - - - public function init() - { - parent::init(); - - $session = Yii::$app->session; - $flashes = $session->getAllFlashes(); - $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; - - foreach ($flashes as $type => $data) { - if (isset($this->alertTypes[$type])) { - $data = (array) $data; - foreach ($data as $i => $message) { - /* initialize css class for each alert box */ - $this->options['class'] = $this->alertTypes[$type] . $appendCss; - - /* assign unique id to each alert box */ - $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; - - echo \yii\bootstrap\Alert::widget([ - 'body' => $message, - 'closeButton' => $this->closeButton, - 'options' => $this->options, - ]); - } - - $session->removeFlash($type); - } - } - } -} diff --git a/frontend/models/ContactForm.php b/frontend/models/ContactForm.php deleted file mode 100644 index d0cc9cb..0000000 --- a/frontend/models/ContactForm.php +++ /dev/null @@ -1,60 +0,0 @@ - '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(); - } -} diff --git a/frontend/models/PasswordResetRequestForm.php b/frontend/models/PasswordResetRequestForm.php deleted file mode 100644 index c11aeec..0000000 --- a/frontend/models/PasswordResetRequestForm.php +++ /dev/null @@ -1,68 +0,0 @@ - '\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(); - } -} diff --git a/frontend/models/ResetPasswordForm.php b/frontend/models/ResetPasswordForm.php deleted file mode 100644 index fb36dd0..0000000 --- a/frontend/models/ResetPasswordForm.php +++ /dev/null @@ -1,64 +0,0 @@ -_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); - } -} diff --git a/frontend/models/SignupForm.php b/frontend/models/SignupForm.php deleted file mode 100644 index 57a51d8..0000000 --- a/frontend/models/SignupForm.php +++ /dev/null @@ -1,58 +0,0 @@ - '\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; - } -} diff --git a/frontend/views/site/login.php b/frontend/views/site/login.php deleted file mode 100644 index 56ea98e..0000000 --- a/frontend/views/site/login.php +++ /dev/null @@ -1,39 +0,0 @@ -title = 'Login'; -$this->params['breadcrumbs'][] = $this->title; -?> - diff --git a/frontend/views/site/requestPasswordResetToken.php b/frontend/views/site/requestPasswordResetToken.php deleted file mode 100644 index 9f6822e..0000000 --- a/frontend/views/site/requestPasswordResetToken.php +++ /dev/null @@ -1,31 +0,0 @@ -title = 'Request password reset'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-

title) ?>

- -

Please fill out your email. A link to reset password will be sent there.

- -
-
- 'request-password-reset-form']); ?> - - field($model, 'email')->textInput(['autofocus' => true]) ?> - -
- 'btn btn-primary']) ?> -
- - -
-
-
diff --git a/frontend/views/site/resetPassword.php b/frontend/views/site/resetPassword.php deleted file mode 100644 index 36ef452..0000000 --- a/frontend/views/site/resetPassword.php +++ /dev/null @@ -1,31 +0,0 @@ -title = 'Reset password'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-

title) ?>

- -

Please choose your new password:

- -
-
- 'reset-password-form']); ?> - - field($model, 'password')->passwordInput(['autofocus' => true]) ?> - -
- 'btn btn-primary']) ?> -
- - -
-
-
diff --git a/frontend/views/site/signup.php b/frontend/views/site/signup.php deleted file mode 100644 index de9dad6..0000000 --- a/frontend/views/site/signup.php +++ /dev/null @@ -1,35 +0,0 @@ -title = 'Signup'; -$this->params['breadcrumbs'][] = $this->title; -?> - diff --git a/frontend/web/img/7_bMIj6pnE4WCbYj8XV7jYIc3PmtwqBi_F.png b/frontend/web/img/7_bMIj6pnE4WCbYj8XV7jYIc3PmtwqBi_F.png new file mode 100644 index 0000000..4eb94e5 Binary files /dev/null and b/frontend/web/img/7_bMIj6pnE4WCbYj8XV7jYIc3PmtwqBi_F.png differ diff --git a/frontend/web/img/8_6cR4qWhyoJXORQG87Vm5K5O5vyq5-0k2.jpg b/frontend/web/img/8_6cR4qWhyoJXORQG87Vm5K5O5vyq5-0k2.jpg new file mode 100644 index 0000000..dca89cc Binary files /dev/null and b/frontend/web/img/8_6cR4qWhyoJXORQG87Vm5K5O5vyq5-0k2.jpg differ -- libgit2 0.21.4