Update message display for usercp

This commit is contained in:
2011-12-21 11:26:18 +00:00
parent e9a0103f57
commit 94fe97b1de

View File

@@ -5,9 +5,6 @@ $request = $main->request();
$auth = $main->auth(); $auth = $main->auth();
$activity = null; $activity = null;
$success = true;
$errors = array();
$successes = array();
if ($request->exists('do')) { if ($request->exists('do')) {
$activity = $request->get('do'); $activity = $request->get('do');
@@ -22,27 +19,33 @@ if ($request->exists('do')) {
if ($user->checkPassword($current_password)) { if ($user->checkPassword($current_password)) {
if ($new_password == $confirm_password) { if ($new_password == $confirm_password) {
$auth->changePassword($new_password); $auth->changePassword($new_password);
$successes[] = 'The password has been changed successfully.'; $messages[] = array(
'severity' => 'success',
'content' => 'The password has been changed successfully.',
);
} else { } else {
$success = false; $messages[] = array(
$errors[] = 'The passwords did not match.'; 'severity' => 'error',
'content' => 'The passwords did not match.',
);
} }
} else { } else {
$success = false; $messages[] = array(
$errors[] = 'The current password was incorrect.'; 'severity' => 'error',
'content' => 'The current password was incorrect.',
);
} }
} break; } break;
default: { default: {
$success = false; $messages[] = array(
$errors[] = "The activity '{$activity}' was not recognised."; 'severity' => 'error',
'content' => "The activity '{$activity}' was not recognised.",
);
} break; } break;
} }
} }
$this->smarty->assign('activity', $activity); $this->smarty->assign('activity', $activity);
$this->smarty->assign('successes', $successes); $this->smarty->assign('messages', $messages);
$this->smarty->assign('errors', $errors);
$this->smarty->assign('requested_page', $this->page);
?> ?>