Fixes #6190 Portal Login Redirect (#6191)
[openemr.git] / portal / verify_session.php
blob9c3507a6d4ee20a3c6eb4eb52cd5dfb05ba7be45
1 <?php
3 /**
4 * portal/verify_session.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Cassian LUP <cassi.lup@gmail.com>
9 * @author Kevin Yeh <kevin.y@integralemr.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2011 Cassian LUP <cassi.lup@gmail.com>
13 * @copyright Copyright (c) 2013 Kevin Yeh <kevin.y@integralemr.com>
14 * @copyright Copyright (c) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
15 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
16 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
19 // All of the common intialization steps for the get_* patient portal functions are now in this single include.
23 //continue session
24 // Will start the (patient) portal OpenEMR session/cookie.
25 require_once(__DIR__ . "/../src/Common/Session/SessionUtil.php");
26 OpenEMR\Common\Session\SessionUtil::portalSessionStart();
28 //landing page definition -- where to go if something goes wrong
29 // if this script is included somewhere else we want to support them changing up the landingpage url such as adding
30 // parameters, or even setting what the landing page should be for the portal verify session.
31 if (!isset($landingpage)) {
32 $landingpage = "index.php?site=" . urlencode($_SESSION['site_id'] ?? null);
36 // kick out if patient not authenticated
37 if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite_two'])) {
38 $pid = $_SESSION['pid'];
39 } else {
40 OpenEMR\Common\Session\SessionUtil::portalSessionCookieDestroy();
41 header('Location: ' . $landingpage . '&w');
42 exit;
47 $ignoreAuth_onsite_portal = true; // ignore the standard authentication for a regular OpenEMR user
48 require_once(dirname(__file__) . './../interface/globals.php');