Merge pull request #12 from maximal/patch-1

Remove redundant `else`s
This commit is contained in:
Carsten Brandt 2015-06-05 17:50:06 +02:00
commit 038192fe50
3 changed files with 8 additions and 12 deletions

View File

@ -61,11 +61,10 @@ class SiteController extends Controller
$model = new LoginForm(); $model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) { if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack(); return $this->goBack();
} else {
return $this->render('login', [
'model' => $model,
]);
} }
return $this->render('login', [
'model' => $model,
]);
} }
public function actionLogout() public function actionLogout()
@ -82,11 +81,10 @@ class SiteController extends Controller
Yii::$app->session->setFlash('contactFormSubmitted'); Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh(); return $this->refresh();
} else {
return $this->render('contact', [
'model' => $model,
]);
} }
return $this->render('contact', [
'model' => $model,
]);
} }
public function actionAbout() public function actionAbout()

View File

@ -57,8 +57,7 @@ class ContactForm extends Model
->send(); ->send();
return true; return true;
} else {
return false;
} }
return false;
} }
} }

View File

@ -58,9 +58,8 @@ class LoginForm extends Model
{ {
if ($this->validate()) { if ($this->validate()) {
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
} else {
return false;
} }
return false;
} }
/** /**