From 94fe97b1debe1eb5fe38545bb53861b0946eb4ec Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Wed, 21 Dec 2011 11:26:18 +0000 Subject: [PATCH] Update message display for usercp --- source/webui/pages/usercp.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/source/webui/pages/usercp.php b/source/webui/pages/usercp.php index 55826b4..6fa317d 100644 --- a/source/webui/pages/usercp.php +++ b/source/webui/pages/usercp.php @@ -5,9 +5,6 @@ $request = $main->request(); $auth = $main->auth(); $activity = null; -$success = true; -$errors = array(); -$successes = array(); if ($request->exists('do')) { $activity = $request->get('do'); @@ -22,27 +19,33 @@ if ($request->exists('do')) { if ($user->checkPassword($current_password)) { if ($new_password == $confirm_password) { $auth->changePassword($new_password); - $successes[] = 'The password has been changed successfully.'; + $messages[] = array( + 'severity' => 'success', + 'content' => 'The password has been changed successfully.', + ); } else { - $success = false; - $errors[] = 'The passwords did not match.'; + $messages[] = array( + 'severity' => 'error', + 'content' => 'The passwords did not match.', + ); } } else { - $success = false; - $errors[] = 'The current password was incorrect.'; + $messages[] = array( + 'severity' => 'error', + 'content' => 'The current password was incorrect.', + ); } } break; default: { - $success = false; - $errors[] = "The activity '{$activity}' was not recognised."; + $messages[] = array( + 'severity' => 'error', + 'content' => "The activity '{$activity}' was not recognised.", + ); } break; } } $this->smarty->assign('activity', $activity); -$this->smarty->assign('successes', $successes); -$this->smarty->assign('errors', $errors); -$this->smarty->assign('requested_page', $this->page); - +$this->smarty->assign('messages', $messages); ?> \ No newline at end of file