diff --git a/backend/config/main.php b/backend/config/main.php
index c4ed214..8ee5909 100644
--- a/backend/config/main.php
+++ b/backend/config/main.php
@@ -14,6 +14,7 @@
'bootstrap' => [ 'log' ],
'controllerMap' => [
'settings' => 'artweb\artbox\core\controllers\SettingsController',
+ 'profile' => 'artweb\artbox\core\controllers\ProfileController',
],
'modules' => [
'imagemanager' => [
@@ -58,7 +59,7 @@
'baseUrl' => '/admin',
],
'user' => [
- 'identityClass' => 'common\models\User',
+ 'identityClass' => 'artweb\artbox\core\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity-backend',
diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php
index 98d3d07..9172704 100644
--- a/backend/views/layouts/main.php
+++ b/backend/views/layouts/main.php
@@ -5,11 +5,13 @@
* @var \yii\web\View $this
*/
+ use artweb\artbox\core\assets\ArtboxCoreAsset;
use artweb\artbox\core\models\User;
use yii\helpers\Html;
use yii\web\View;
- $bundle = yiister\gentelella\assets\Asset::register($this);
+ yiister\gentelella\assets\Asset::register($this);
+ ArtboxCoreAsset::register($this);
/**
* @var User $user
*/
diff --git a/backend/views/site/index.php b/backend/views/site/index.php
index 3854e2c..5e2779b 100644
--- a/backend/views/site/index.php
+++ b/backend/views/site/index.php
@@ -3,7 +3,6 @@
/* @var $this yii\web\View */
use artweb\artbox\gentelella\widgets\XPanel;
- use yii\bootstrap\Carousel;
use yii\bootstrap\Collapse;
$this->title = 'My Yii Application';
@@ -11,31 +10,49 @@
'Test',
- 'toolbarLayout' => '{close}{collapse}',
+ 'title' => 'Test',
+ ]
+ );
+ echo Collapse::widget(
+ [
+ 'items' => [
+ // equivalent to the above
+ [
+ 'label' => '
Collapsible Group Item #1
',
+ 'content' => 'Anim pariatur cliche...',
+ // open its content by default
+ 'contentOptions' => [ 'class' => 'in' ],
+ ],
+ // another group item
+ [
+ 'label' => 'Collapsible Group Item #1',
+ 'content' => 'Anim pariatur cliche...',
+ ],
+ // if you want to swap out .panel-body with .list-group, you may use the following
+ [
+ 'label' => 'Collapsible Group Item #1',
+ 'content' => [
+ 'Anim pariatur cliche...',
+ 'Anim pariatur cliche...',
+ ],
+ 'footer' => 'Footer'
+ // the footer label in list-group
+ ],
+ [
+ 'label' => 'Collapsible Group Item #1',
+ 'content' => [
+ 'Anim pariatur cliche...',
+ 'Anim pariatur cliche...',
+ ],
+ 'footer' => 'Footer',
+ // the footer label in list-group
+ ],
+ ],
+ 'options' => [
+ 'class' => 'accordion',
+ ],
+ 'encodeLabels' => false,
]
);
- echo "Velox nuclear vexatum iaceres ducunt ad eleates.";
$panel::end();
-?>
-
-
-
-
Velox nuclear vexatum iaceres ducunt ad eleates.
-
-
+?>
\ No newline at end of file
diff --git a/common/config/.gitignore b/common/config/.gitignore
old mode 100755
new mode 100644
index 4104a6e..4104a6e
--- a/common/config/.gitignore
+++ b/common/config/.gitignore
diff --git a/common/config/bootstrap.php b/common/config/bootstrap.php
old mode 100755
new mode 100644
index 40fff15..40fff15
--- a/common/config/bootstrap.php
+++ b/common/config/bootstrap.php
diff --git a/common/config/main.php b/common/config/main.php
old mode 100755
new mode 100644
index 58e25bc..58e25bc
--- a/common/config/main.php
+++ b/common/config/main.php
diff --git a/common/config/params.php b/common/config/params.php
old mode 100755
new mode 100644
index 4ec9ba6..4ec9ba6
--- a/common/config/params.php
+++ b/common/config/params.php
diff --git a/common/config/settings.php b/common/config/settings.php
old mode 100755
new mode 100644
index a1aed26..49eeb3f
--- a/common/config/settings.php
+++ b/common/config/settings.php
@@ -2,8 +2,8 @@
return [
1 => [
- 'id' => '1',
- 'name' => 'Admin',
+ 'id' => '1',
+ 'name' => 'Admin321',
'description' => 'Site administrator',
],
];
\ No newline at end of file
diff --git a/common/config/test.php b/common/config/test.php
old mode 100755
new mode 100644
index c952c41..c952c41
--- a/common/config/test.php
+++ b/common/config/test.php
diff --git a/common/models/LoginForm.php b/common/models/LoginForm.php
index c4869d4..9df968f 100644
--- a/common/models/LoginForm.php
+++ b/common/models/LoginForm.php
@@ -1,78 +1,90 @@
hasErrors()) {
- $user = $this->getUser();
- if (!$user || !$user->validatePassword($this->password)) {
- $this->addError($attribute, 'Incorrect username or password.');
+ public $username;
+ public $password;
+ public $rememberMe = true;
+
+ private $_user;
+
+ /**
+ * @inheritdoc
+ */
+ 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);
- } else {
- return false;
+
+ /**
+ * 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);
+
+ /**
+ * Finds user by [[username]]
+ *
+ * @return User|null
+ */
+ protected function getUser()
+ {
+ if ($this->_user === null) {
+ $this->_user = User::findByUsername($this->username);
+ }
+
+ return $this->_user;
}
-
- return $this->_user;
}
-}
diff --git a/common/models/User.php b/common/models/User.php
deleted file mode 100644
index 2f4508f..0000000
--- a/common/models/User.php
+++ /dev/null
@@ -1,189 +0,0 @@
- self::STATUS_ACTIVE],
- ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public static function findIdentity($id)
- {
- return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
- }
-
- /**
- * @inheritdoc
- */
- public static function findIdentityByAccessToken($token, $type = null)
- {
- throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
- }
-
- /**
- * Finds user by username
- *
- * @param string $username
- * @return static|null
- */
- public static function findByUsername($username)
- {
- return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]);
- }
-
- /**
- * Finds user by password reset token
- *
- * @param string $token password reset token
- * @return static|null
- */
- public static function findByPasswordResetToken($token)
- {
- if (!static::isPasswordResetTokenValid($token)) {
- return null;
- }
-
- return static::findOne([
- 'password_reset_token' => $token,
- 'status' => self::STATUS_ACTIVE,
- ]);
- }
-
- /**
- * Finds out if password reset token is valid
- *
- * @param string $token password reset token
- * @return bool
- */
- public static function isPasswordResetTokenValid($token)
- {
- if (empty($token)) {
- return false;
- }
-
- $timestamp = (int) substr($token, strrpos($token, '_') + 1);
- $expire = Yii::$app->params['user.passwordResetTokenExpire'];
- return $timestamp + $expire >= time();
- }
-
- /**
- * @inheritdoc
- */
- public function getId()
- {
- return $this->getPrimaryKey();
- }
-
- /**
- * @inheritdoc
- */
- public function getAuthKey()
- {
- return $this->auth_key;
- }
-
- /**
- * @inheritdoc
- */
- public function validateAuthKey($authKey)
- {
- return $this->getAuthKey() === $authKey;
- }
-
- /**
- * Validates password
- *
- * @param string $password password to validate
- * @return bool if password provided is valid for current user
- */
- public function validatePassword($password)
- {
- return Yii::$app->security->validatePassword($password, $this->password_hash);
- }
-
- /**
- * Generates password hash from password and sets it to the model
- *
- * @param string $password
- */
- public function setPassword($password)
- {
- $this->password_hash = Yii::$app->security->generatePasswordHash($password);
- }
-
- /**
- * Generates "remember me" authentication key
- */
- public function generateAuthKey()
- {
- $this->auth_key = Yii::$app->security->generateRandomString();
- }
-
- /**
- * Generates new password reset token
- */
- public function generatePasswordResetToken()
- {
- $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
- }
-
- /**
- * Removes password reset token
- */
- public function removePasswordResetToken()
- {
- $this->password_reset_token = null;
- }
-}
diff --git a/console/controllers/CreateController.php b/console/controllers/CreateController.php
index 5fa19c4..2fc326b 100644
--- a/console/controllers/CreateController.php
+++ b/console/controllers/CreateController.php
@@ -1,7 +1,7 @@