diff --git a/include/class.auth.php b/include/class.auth.php index a1b8c52209cbcd272bd44b025172a3b1bc47a350..81693040092784c1b4964d16ab0b58f5adf4c4de 100644 --- a/include/class.auth.php +++ b/include/class.auth.php @@ -448,7 +448,7 @@ abstract class UserAuthenticationBackend extends AuthenticationBackend { } function getAllowedBackends($userid) { - $backends = array(); + $backends = array('authlink'); $sql = 'SELECT A1.backend FROM '.USER_ACCOUNT_TABLE .' A1 INNER JOIN '.USER_EMAIL_TABLE.' A2 ON (A2.user_id = A1.user_id)' .' WHERE backend IS NOT NULL ' @@ -888,20 +888,18 @@ class AccessLinkAuthentication extends UserAuthenticationBackend { function authenticate($email, $number) { if (!($ticket = Ticket::lookupByNumber($number)) - || !($user=User::lookup(array('emails__address' => - $email)))) + || !($user=User::lookup(array('emails__address' => $email)))) return false; - //Ticket owner? + // Ticket owner? if ($ticket->getUserId() == $user->getId()) $user = $ticket->getOwner(); - //Collaborator? - elseif (!($user = Collaborator::lookup(array('userId' => - $user->getId(), 'ticketId' => - $ticket->getId())))) + // Collaborator? + elseif (!($user = Collaborator::lookup(array( + 'userId' => $user->getId(), + 'ticketId' => $ticket->getId())))) return false; //Bro, we don't know you! - return new ClientSession($user); } diff --git a/include/client/accesslink.inc.php b/include/client/accesslink.inc.php index f588f3249f33d3f5684a2867487e67aa3cf655a2..183742d5a6792dac6b9a67ca44d45ed5a0b077fe 100644 --- a/include/client/accesslink.inc.php +++ b/include/client/accesslink.inc.php @@ -10,7 +10,7 @@ link will be emailed to you.</p> <form action="login.php" method="post" id="clientLogin"> <?php csrf_token(); ?> <div style="display:table-row"> - <div style="display:table-cell;width:40%"> + <div style="width:40%;display:table-cell;box-shadow: 12px 0 15px -15px rgba(0,0,0,0.4);padding-right: 2em;"> <strong><?php echo Format::htmlchars($errors['login']); ?></strong> <br> <div> @@ -25,7 +25,16 @@ link will be emailed to you.</p> <input class="btn" type="submit" value="Email Access Link"> </p> </div> - <div style="display:table-cell"></div> + <div style="display:table-cell;padding-left: 2em;padding-right:90px;"> +<?php if ($cfg && $cfg->getClientRegistrationMode() !== 'disabled') { ?> + Have an account with us? + <a href="login.php?do=create">Sign In</a> <?php + if ($cfg->isClientRegistrationEnabled()) { ?> + or <a href="login.php?do=create">register for an account</a> <?php + } ?> to access all your tickets. +<?php +} ?> + </div> </div> </form> <br> diff --git a/include/client/header.inc.php b/include/client/header.inc.php index e7031dd3edb84c0107185c92e9db84a0a8d070c5..e6ea209f4048ee21b92244bfc0e504e82a89c8fa 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -56,7 +56,7 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); Guest User | <?php } if ($cfg->getClientRegistrationMode() != 'disabled') { ?> - <a href="<?php echo ROOT_PATH; ?>login.php">Log In</a> + <a href="<?php echo ROOT_PATH; ?>login.php">Sign In</a> <?php } } ?> diff --git a/login.php b/login.php index 41658e48364725c00be88ba3baf476d91165aaf7..5d1faa1ecd24944e76a4b453731ffb164a425301 100644 --- a/login.php +++ b/login.php @@ -24,7 +24,8 @@ define('OSTCLIENTINC',TRUE); //make includes happy require_once(INCLUDE_DIR.'class.client.php'); require_once(INCLUDE_DIR.'class.ticket.php'); -if ($cfg->getClientRegistrationMode() == 'disabled') +if ($cfg->getClientRegistrationMode() == 'disabled' + || isset($_POST['lticket'])) $inc = 'accesslink.inc.php'; else $inc = 'login.inc.php'; diff --git a/tickets.php b/tickets.php index 35bf1a0cfffeed927748c8a60d571502e70766cd..9561da31dd62bd7ecbccb4f4b83326845b279e3f 100644 --- a/tickets.php +++ b/tickets.php @@ -32,6 +32,9 @@ if($_REQUEST['id']) { } } +if (!$ticket && $thisclient->isGuest()) + Http::redirect('view.php'); + //Process post...depends on $ticket object above. if($_POST && is_object($ticket) && $ticket->getId()): $errors=array(); diff --git a/view.php b/view.php index e4e143b8cd76ba1910558d7c9dee7b62ff24a4f1..abf7d805ac5acf5f82353ab66201ac787c9357bf 100644 --- a/view.php +++ b/view.php @@ -19,13 +19,15 @@ require_once('client.inc.php'); // Try autologin the user // Authenticated user can be of type ticket owner or collaborator $errors = array(); -$user = UserAuthenticationBackend::processSignOn($errors); +$user = UserAuthenticationBackend::processSignOn($errors, false); if ($user && $user->getTicketId()) Http::redirect('tickets.php?id='.$user->getTicketId()); $nav = new UserNav(); $nav->setActiveNav('status'); -//Simply redirecting to tickets.php until multiview is implemented. -require('tickets.php'); +$inc = 'accesslink.inc.php'; +require CLIENTINC_DIR.'header.inc.php'; +require CLIENTINC_DIR.$inc; +require CLIENTINC_DIR.'footer.inc.php'; ?>