|
@@ -12,7 +12,7 @@ use yii\web\Controller;
|
|
use yii\web\NotFoundHttpException;
|
|
use yii\web\NotFoundHttpException;
|
|
use yii\filters\VerbFilter;
|
|
use yii\filters\VerbFilter;
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
-
|
|
|
|
|
|
+use app\models\LoginForm;
|
|
/**
|
|
/**
|
|
* SiteController implements the CRUD actions for Orderreturn model.
|
|
* SiteController implements the CRUD actions for Orderreturn model.
|
|
*/
|
|
*/
|
|
@@ -46,6 +46,9 @@ class SiteController extends Controller
|
|
*/
|
|
*/
|
|
public function actionIndex()
|
|
public function actionIndex()
|
|
{
|
|
{
|
|
|
|
+ if (Yii::$app->user->isGuest) {
|
|
|
|
+ return $this->redirect(['login']);
|
|
|
|
+ }
|
|
$request = Yii::$app->request;
|
|
$request = Yii::$app->request;
|
|
$shop=$request->get('shop',1);
|
|
$shop=$request->get('shop',1);
|
|
$searchModel = new OrderreturnSearch();
|
|
$searchModel = new OrderreturnSearch();
|
|
@@ -205,6 +208,41 @@ class SiteController extends Controller
|
|
return $this->render('upload', ['model' => $model]);
|
|
return $this->render('upload', ['model' => $model]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Login action.
|
|
|
|
+ *
|
|
|
|
+ * @return Response|string
|
|
|
|
+ */
|
|
|
|
+ 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();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $model->password = '';
|
|
|
|
+ return $this->render('login', [
|
|
|
|
+ 'model' => $model,
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * Logout action.
|
|
|
|
+ *
|
|
|
|
+ * @return Response
|
|
|
|
+ */
|
|
|
|
+ public function actionLogout()
|
|
|
|
+ {
|
|
|
|
+ Yii::$app->user->logout();
|
|
|
|
+
|
|
|
|
+ return $this->goHome();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Finds the Orderreturn model based on its primary key value.
|
|
* Finds the Orderreturn model based on its primary key value.
|
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
|
* If the model is not found, a 404 HTTP exception will be thrown.
|