Permalink
Browse files

Fix bug in message handling. FlashMessenger content was not available…

… until the subsequent page load. Add auth messages to the view directly takes care of it.
  • Loading branch information...
1 parent 359cb0e commit da2507df114ec3a632e64410e5cc8df5679d28b6 @jeremiahsmall jeremiahsmall committed Mar 10, 2013
Showing with 13 additions and 11 deletions.
  1. +13 −11 module/Application/src/Application/Controller/LoginController.php
@@ -27,13 +27,13 @@ public function indexAction()
$result = $adapter->setLayoutname('Project')->execute();
if ($result['error'] === 0){
- $messages = $adapter->getDbname() . ' is hosted on ' . $adapter->getHostname() . '.';
+ $installMessages = $adapter->getDbname() . ' is hosted on ' . $adapter->getHostname() . '.';
$serverIsOnline = TRUE;
} else {
- $messages[] = 'Error Type: ' . $result['errortype'];
- $messages[] = 'Error Code: ' . $result['error'];
- $messages[] = 'Error Text: ' . $result['errortext'];
- $messages[] = 'Adapter URL: ' . $result['url'];
+ $installMessages[] = 'Error Type: ' . $result['errortype'];
+ $installMessages[] = 'Error Code: ' . $result['error'];
+ $installMessages[] = 'Error Text: ' . $result['errortext'];
+ $installMessages[] = 'Adapter URL: ' . $result['url'];
$serverIsOnline = FALSE;
}
@@ -44,7 +44,8 @@ public function indexAction()
return $this->redirect()->toRoute('home');
}
- $form = $this->getForm();
+ $form = $this->getForm();
+ $messages = array();
$request = $this->getRequest();
@@ -63,8 +64,9 @@ public function indexAction()
foreach($result->getMessages() as $message)
{
- //save message temporary into flashmessenger
+ //save messages into view messages and flashmessenger
if (is_string($message)){
+ $messages[] = $message;
$this->flashmessenger()->addMessage($message);
}
}
@@ -85,10 +87,10 @@ public function indexAction()
}
return array(
- 'form' => $this->getForm(),
- 'messages' => $this->flashmessenger()->getMessages(),
- 'installMessages' => $messages,
- 'serverIsOnline' => $serverIsOnline,
+ 'form' => $form,
+ 'messages' => $messages,
+ 'installMessages' => $installMessages,
+ 'serverIsOnline' => $serverIsOnline,
);
}

0 comments on commit da2507d

Please sign in to comment.