From 89b28923e5566158864fe9ed1b8334bea2db3844 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 19 Dec 2013 22:03:08 -0600 Subject: [PATCH] Add profile management page --- include/client/header.inc.php | 5 +++-- include/client/profile.inc.php | 25 ++++++++++++++++++++++++ profile.php | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 include/client/profile.inc.php create mode 100644 profile.php diff --git a/include/client/header.inc.php b/include/client/header.inc.php index 4f1c93f88..107cf479c 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -44,8 +44,9 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); <p> <?php if($thisclient && is_object($thisclient) && $thisclient->isValid()) { - echo Format::htmlchars($thisclient->getName()).' - '; + echo Format::htmlchars($thisclient->getName()).' |'; ?> + <a href="<?php echo ROOT_PATH; ?>profile.php">Profile</a> | <?php if($cfg->showRelatedTickets()) {?> <a href="<?php echo ROOT_PATH; ?>tickets.php">Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> - @@ -54,7 +55,7 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); <a href="<?php echo ROOT_PATH; ?>logout.php?auth=<?php echo $ost->getLinkToken(); ?>">Log Out</a> <?php }elseif($nav){ ?> - Guest User - <a href="<?php echo ROOT_PATH; ?>login.php">Log In</a> + Guest User | <a href="<?php echo ROOT_PATH; ?>login.php">Log In</a> <?php } ?> </p> diff --git a/include/client/profile.inc.php b/include/client/profile.inc.php new file mode 100644 index 000000000..a103ba1f7 --- /dev/null +++ b/include/client/profile.inc.php @@ -0,0 +1,25 @@ +<?php + +?> +<h1>Manage Your Profile Information</h1> +<p> +Use the forms below to update the information we have on file for your +account +</p> +<form action="profile.php" method="post"> + <?php csrf_token(); ?> +<table width="800"> +<?php +foreach ($user->getForms() as $f) { + $f->render(false); +} +?> +</table> +<hr> +<p style="text-align: center;"> + <input type="submit" value="Update"/> + <input type="reset" value="Reset"/> + <input type="button" value="Cancel" onclick="javascript: + window.location.href='index.php';"/> +</p> +</form> diff --git a/profile.php b/profile.php new file mode 100644 index 000000000..e17bf690e --- /dev/null +++ b/profile.php @@ -0,0 +1,35 @@ +<?php +/********************************************************************* + profile.php + + Manage client profile. This will allow a logged-in user to manage + his/her own public (non-internal) information + + Peter Rotich <peter@osticket.com> + Jared Hancock <jared@osticket.com> + Copyright (c) 2006-2013 osTicket + http://www.osticket.com + + Released under the GNU General Public License WITHOUT ANY WARRANTY. + See LICENSE.TXT for details. + + vim: expandtab sw=4 ts=4 sts=4: + $Id: $ +**********************************************************************/ +require 'secure.inc.php'; + +require_once 'class.user.php'; +$user = User::lookup($thisclient->getId()); + +if ($user && $_POST) { + $errors = array(); + if ($user->updateInfo($_POST, $errors)) + Http::redirect('tickets.php'); +} + +$inc = 'profile.inc.php'; + +include(CLIENTINC_DIR.'header.inc.php'); +include(CLIENTINC_DIR.$inc); +include(CLIENTINC_DIR.'footer.inc.php'); + -- GitLab