diff --git a/.gitignore b/.gitignore index e587688..9b126c3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ phpunit.phar /phpunit.xml /node_modules + +/frontend/web/profile/** +!/frontend/web/profile/.gitkeep \ No newline at end of file diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php index 73bd4ec..a72bc07 100644 --- a/backend/controllers/SiteController.php +++ b/backend/controllers/SiteController.php @@ -6,6 +6,7 @@ use yii\filters\AccessControl; use yii\web\Controller; use common\models\LoginForm; use yii\filters\VerbFilter; +use backend\models\UploadForm; /** * Site controller @@ -22,7 +23,7 @@ class SiteController extends Controller 'class' => AccessControl::className(), 'rules' => [ [ - 'actions' => ['login', 'error'], + 'actions' => ['login', 'error','upload-image'], 'allow' => true, ], [ @@ -55,7 +56,6 @@ class SiteController extends Controller public function actionIndex() { - Yii::$app->security->generatePasswordHash('test'); return $this->render('index'); } @@ -85,4 +85,11 @@ class SiteController extends Controller return $this->goHome(); } + + public function actionUploadImage(){ + \yii::$app->request->enableCsrfValidation = false; + $model = new UploadForm(); + + return $this->render('upload', ['model' =>$model]); + } } diff --git a/backend/controllers/UploadController.php b/backend/controllers/UploadController.php new file mode 100644 index 0000000..b043596 --- /dev/null +++ b/backend/controllers/UploadController.php @@ -0,0 +1,46 @@ + + user->isGuest ){?> diff --git a/backend/views/site/upload.php b/backend/views/site/upload.php new file mode 100644 index 0000000..57e9f0a --- /dev/null +++ b/backend/views/site/upload.php @@ -0,0 +1,24 @@ + + +
+ + ['enctype' => 'multipart/form-data']]); ?> + + +
+ 'btn btn-primary']) ?> +
+ + + +
+ \ No newline at end of file diff --git a/frontend/web/profile/.gitkeep b/frontend/web/profile/.gitkeep new file mode 100644 index 0000000..e69de29