Selaa lähdekoodia

Fixed minor consistency bugs in apps * Added 'return' to goHome() calls in actions * Changed $_POST to Yii::$app->request->post()

Johnny Theill 12 vuotta sitten
vanhempi
commit
0eff9fb382
1 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 3 3
      controllers/SiteController.php

+ 3 - 3
controllers/SiteController.php

@@ -55,11 +55,11 @@ class SiteController extends Controller
 	public function actionLogin()
 	{
 		if (!\Yii::$app->user->isGuest) {
-			$this->goHome();
+			return $this->goHome();
 		}
 
 		$model = new LoginForm();
-		if ($model->load($_POST) && $model->login()) {
+		if ($model->load(Yii::$app->request->post()) && $model->login()) {
 			return $this->goBack();
 		} else {
 			return $this->render('login', [
@@ -77,7 +77,7 @@ class SiteController extends Controller
 	public function actionContact()
 	{
 		$model = new ContactForm;
-		if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
+		if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
 			Yii::$app->session->setFlash('contactFormSubmitted');
 			return $this->refresh();
 		} else {