Skip to content
Snippets Groups Projects
Commit 01e6e122 authored by Jared Hancock's avatar Jared Hancock
Browse files

Redirect to originally-requested page on login

Instead of always showing the tickets page
parent e145ede0
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ $content = Page::lookup(Page::getIdByType('registration-policy')); ...@@ -12,7 +12,7 @@ $content = Page::lookup(Page::getIdByType('registration-policy'));
<form action="login.php" method="post" id="clientLogin"> <form action="login.php" method="post" id="clientLogin">
<?php csrf_token(); ?> <?php csrf_token(); ?>
<div style="display:table-row"> <div style="display:table-row">
<div style="width:40%;display:table-cell"> <div style="width:40%;display:table-cell;box-shadow: 12px 0 15px -15px rgba(0,0,0,0.4);padding-left: 2em;">
<strong><?php echo Format::htmlchars($errors['login']); ?></strong> <strong><?php echo Format::htmlchars($errors['login']); ?></strong>
<br> <br>
<div> <div>
...@@ -27,11 +27,11 @@ $content = Page::lookup(Page::getIdByType('registration-policy')); ...@@ -27,11 +27,11 @@ $content = Page::lookup(Page::getIdByType('registration-policy'));
<input class="btn" type="submit" value="Sign In"> <input class="btn" type="submit" value="Sign In">
</p> </p>
</div> </div>
<div style="display:table-cell;padding-left: 2em;">
<?php if ($cfg && $cfg->isClientRegistrationEnabled()) { ?> <?php if ($cfg && $cfg->isClientRegistrationEnabled()) { ?>
<div style="display:table-cell;box-shadow: -9px 0 15px -12px rgba(0,0,0,0.3);padding-left: 2em;">
Not yet registered? <a href="account.php?do=create">Create an account</a> Not yet registered? <a href="account.php?do=create">Create an account</a>
</div>
<?php } ?> <?php } ?>
</div>
</div> </div>
</form> </form>
<br> <br>
......
...@@ -30,15 +30,16 @@ if ($_POST) { ...@@ -30,15 +30,16 @@ if ($_POST) {
$errors['err'] = 'Valid username or email address is required'; $errors['err'] = 'Valid username or email address is required';
elseif (($user = UserAuthenticationBackend::process($_POST['luser'], elseif (($user = UserAuthenticationBackend::process($_POST['luser'],
$_POST['lpasswd'], $errors))) { $_POST['lpasswd'], $errors))) {
Http::redirect('tickets.php'); Http::redirect($_SESSION['_client']['auth']['dest'] ?: 'tickets.php');
$_POST = null;
} elseif(!$errors['err']) { } elseif(!$errors['err']) {
$errors['err'] = 'Invalid email or ticket number - try again!'; $errors['err'] = 'Invalid email or ticket number - try again!';
} }
} }
$nav = new UserNav(); if (!$nav) {
$nav->setActiveNav('status'); $nav = new UserNav();
$nav->setActiveNav('status');
}
require CLIENTINC_DIR.'header.inc.php'; require CLIENTINC_DIR.'header.inc.php';
require CLIENTINC_DIR.$inc; require CLIENTINC_DIR.$inc;
require CLIENTINC_DIR.'footer.inc.php'; require CLIENTINC_DIR.'footer.inc.php';
......
...@@ -17,7 +17,7 @@ require('client.inc.php'); ...@@ -17,7 +17,7 @@ require('client.inc.php');
define('SOURCE','Web'); //Ticket source. define('SOURCE','Web'); //Ticket source.
$ticket = null; $ticket = null;
$errors=array(); $errors=array();
if($_POST): if ($_POST) {
$vars = $_POST; $vars = $_POST;
$vars['deptId']=$vars['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected. $vars['deptId']=$vars['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected.
if ($thisclient) { if ($thisclient) {
...@@ -60,10 +60,14 @@ if($_POST): ...@@ -60,10 +60,14 @@ if($_POST):
}else{ }else{
$errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!'; $errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!';
} }
endif; }
//page //page
$nav->setActiveNav('new'); $nav->setActiveNav('new');
if ($cfg->isClientLoginRequired() && !$thisclient) {
require_once 'secure.inc.php';
}
require(CLIENTINC_DIR.'header.inc.php'); require(CLIENTINC_DIR.'header.inc.php');
if($ticket if($ticket
&& ( && (
...@@ -76,9 +80,8 @@ if($ticket ...@@ -76,9 +80,8 @@ if($ticket
array_fill(0, 3, 'XXXXXX'), array_fill(0, 3, 'XXXXXX'),
$page->getBody() $page->getBody()
))); )));
} elseif ($cfg->isClientLoginRequired() && !$thisclient) { }
require(CLIENTINC_DIR.'login.inc.php'); else {
} else {
require(CLIENTINC_DIR.'open.inc.php'); require(CLIENTINC_DIR.'open.inc.php');
} }
require(CLIENTINC_DIR.'footer.inc.php'); require(CLIENTINC_DIR.'footer.inc.php');
......
...@@ -20,7 +20,9 @@ require_once('client.inc.php'); ...@@ -20,7 +20,9 @@ require_once('client.inc.php');
//Client Login page: Ajax interface can pre-declare the function to trap logins. //Client Login page: Ajax interface can pre-declare the function to trap logins.
if(!function_exists('clientLoginPage')) { if(!function_exists('clientLoginPage')) {
function clientLoginPage($msg ='') { function clientLoginPage($msg ='') {
global $ost; global $ost, $cfg, $nav;
$_SESSION['_client']['auth']['dest'] =
'/' . ltrim($_SERVER['REQUEST_URI'], '/');
require('./login.php'); require('./login.php');
exit; exit;
} }
......
...@@ -23,6 +23,9 @@ $user = UserAuthenticationBackend::processSignOn($errors); ...@@ -23,6 +23,9 @@ $user = UserAuthenticationBackend::processSignOn($errors);
if ($user && $user->getTicketId()) if ($user && $user->getTicketId())
Http::redirect('tickets.php?id='.$user->getTicketId()); Http::redirect('tickets.php?id='.$user->getTicketId());
$nav = new UserNav();
$nav->setActiveNav('status');
//Simply redirecting to tickets.php until multiview is implemented. //Simply redirecting to tickets.php until multiview is implemented.
require('tickets.php'); require('tickets.php');
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment