From 2eb9930fd0f4cdfa091dd80e698c8e820e083075 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 21 Mar 2014 14:59:19 -0500 Subject: [PATCH] Move profile.php to account.php For client account / profile updates --- account.php | 16 +++++++++++++++- include/client/header.inc.php | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/account.php b/account.php index 3391e46bc..4a5f96d7e 100644 --- a/account.php +++ b/account.php @@ -20,12 +20,26 @@ require 'client.inc.php'; $inc = 'register.inc.php'; +$errors = array(); + if (!$cfg || !$cfg->isClientRegistrationEnabled()) { Http::redirect('index.php'); } +elseif ($thisclient) { + $inc = 'profile.inc.php'; + $user = User::lookup($thisclient->getId()); +} + +if ($user && $_POST) { + if ($acct = $thisclient->getAccount()) { + $acct->update($_POST, $errors); + } + if (!$errors && $user->updateInfo($_POST, $errors)) + Http::redirect('tickets.php'); +} + elseif ($_POST) { - $errors = array(); $user_form = UserForm::getUserForm()->getForm($_POST); if (!$user_form->isValid(function($f) { return !$f->get('internal'); })) $errors['err'] = 'Incomplete client information'; diff --git a/include/client/header.inc.php b/include/client/header.inc.php index 107cf479c..1fe599486 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -46,7 +46,7 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); if($thisclient && is_object($thisclient) && $thisclient->isValid()) { echo Format::htmlchars($thisclient->getName()).' |'; ?> - <a href="<?php echo ROOT_PATH; ?>profile.php">Profile</a> | + <a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> | <?php if($cfg->showRelatedTickets()) {?> <a href="<?php echo ROOT_PATH; ?>tickets.php">Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> - -- GitLab