public function actionPassword() { $model = new PasswordForm(); if (isset($_POST['PasswordForm'])) { $model->attributes = $_POST['PasswordForm']; if ($model->validate()) { $password = UserIdentity::createPassword($model->password, $model->cost); return $this->render('password_generated', array('password' => $password)); } } $model->cost = 8; $this->render('password', array('model' => $model)); }