4 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
5 * Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
7 * LICENSE: This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * @author Jerry Padgett <sjpadgett@gmail.com>
22 * @author Cassian LUP <cassi.lup@gmail.com>
23 * @link http://www.open-emr.org
26 //setting the session & other config options
29 //don't require standard openemr authorization in globals.php
32 //For redirect if the site on session does not match
33 $landingpage = "index.php?site=".$_GET['site'];
36 require_once('../interface/globals.php');
38 ini_set("error_log", E_ERROR || ~E_NOTICE
);
39 //exit if portal is turned off
40 if (!(isset($GLOBALS['portal_onsite_two_enable'])) ||
!($GLOBALS['portal_onsite_two_enable'])) {
41 echo htmlspecialchars(xl('Patient Portal is turned off'), ENT_NOQUOTES
);
45 // security measure -- will check on next page.
46 $_SESSION['itsme'] = 1;
50 // Deal with language selection
52 // collect default language id (skip this if this is a password update)
53 if (!(isset($_SESSION['password_update']))) {
54 $res2 = sqlStatement("select * from lang_languages where lang_description = ?", array($GLOBALS['language_default']));
55 for ($iter = 0; $row = sqlFetchArray($res2); $iter++
) {
56 $result2[$iter] = $row;
59 if (count($result2) == 1) {
60 $defaultLangID = $result2[0]{"lang_id"};
61 $defaultLangName = $result2[0]{"lang_description"};
63 //default to english if any problems
65 $defaultLangName = "English";
68 // set session variable to default so login information appears in default language
69 $_SESSION['language_choice'] = $defaultLangID;
70 // collect languages if showing language menu
71 if ($GLOBALS['language_menu_login']) {
72 // sorting order of language titles depends on language translation options.
73 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
74 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation'])) {
75 $sql = "SELECT * FROM lang_languages ORDER BY lang_description, lang_id";
76 $res3=SqlStatement($sql);
78 // Use and sort by the translated language name.
79 $sql = "SELECT ll.lang_id, " .
80 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
81 "ll.lang_description " .
82 "FROM lang_languages AS ll " .
83 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
84 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
86 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
87 $res3=SqlStatement($sql, array($mainLangID));
90 for ($iter = 0; $row = sqlFetchArray($res3); $iter++
) {
91 $result3[$iter] = $row;
94 if (count($result3) == 1) {
95 //default to english if only return one language
96 $hiddenLanguageField = "<input type='hidden' name='languageChoice' value='1' />\n";
99 $hiddenLanguageField = "<input type='hidden' name='languageChoice' value='".htmlspecialchars($defaultLangID, ENT_QUOTES
)."' />\n";
107 <title
><?php
echo xlt('Patient Portal Login'); ?
></title
>
109 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-11-3/index.js"></script
>
110 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery.gritter-1-7-4/js/jquery.gritter.min.js"></script
>
112 <link rel
="stylesheet" type
="text/css" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery.gritter-1-7-4/css/jquery.gritter.css" />
113 <link rel
="stylesheet" type
="text/css" href
="assets/css/base.css?v=<?php echo $v_js_includes; ?>" />
115 <script type
="text/javascript">
119 alert ('<?php echo addslashes(xl('Field(s
) are missing
!')); ?>');
123 function validate() {
125 if (document
.getElementById('uname').value
== "") {
126 document
.getElementById('uname').style
.border
= "1px solid red";
129 if (document
.getElementById('pass').value
== "") {
130 document
.getElementById('pass').style
.border
= "1px solid red";
135 function process_new_pass() {
137 if (!(validate_new_pass())) {
138 alert ('<?php echo addslashes(xl('Field(s
) are missing
!')); ?>');
141 if (document
.getElementById('pass_new').value
!= document
.getElementById('pass_new_confirm').value
) {
142 alert ('<?php echo addslashes(xl('The
new password fields are not the same
.')); ?>');
145 if (document
.getElementById('pass').value
== document
.getElementById('pass_new').value
) {
146 alert ('<?php echo addslashes(xl('The
new password can not be the same
as the current password
.')); ?>');
151 function validate_new_pass() {
153 if (document
.getElementById('uname').value
== "") {
154 document
.getElementById('uname').style
.border
= "1px solid red";
157 if (document
.getElementById('pass').value
== "") {
158 document
.getElementById('pass').style
.border
= "1px solid red";
161 if (document
.getElementById('pass_new').value
== "") {
162 document
.getElementById('pass_new').style
.border
= "1px solid red";
165 if (document
.getElementById('pass_new_confirm').value
== "") {
166 document
.getElementById('pass_new_confirm').style
.border
= "1px solid red";
172 <style type
="text/css">
174 font
-family
: sans
-serif
;
175 background
-color
: #638fd0;
177 background
: -webkit
-radial
-gradient(circle
, white
, #638fd0);
178 background
: -moz
-radial
-gradient(circle
, white
, #638fd0);
189 <?php
if (isset($_SESSION['password_update'])||
isset($_GET['password_update'])) {
190 $_SESSION['password_update']=1;
192 <div id
="wrapper" class="centerwrapper">
193 <h2
class="title"><?php
echo xlt('Please Enter a New Password'); ?
></h2
>
194 <form action
="get_patient_info.php" method
="POST" onsubmit
="return process_new_pass()" >
197 <td
class="algnRight"><?php
echo xlt('User Name'); ?
></td
>
198 <td
><input name
="uname" id
="uname" type
="text" autocomplete
="off" value
="<?php echo attr($_SESSION['portal_username']); ?>"/></td
>
201 <td
class="algnRight"><?php
echo xlt('Current Password');?
></>
203 <input name
="pass" id
="pass" type
="password" autocomplete
="off" />
207 <td
class="algnRight"><?php
echo xlt('New Password');?
></>
209 <input name
="pass_new" id
="pass_new" type
="password" />
213 <td
class="algnRight"><?php
echo xlt('Confirm New Password');?
></>
215 <input name
="pass_new_confirm" id
="pass_new_confirm" type
="password" />
219 <td colspan
=2><br
><center
><input type
="submit" value
="<?php echo xlt('Log In');?>" /></center
></td
>
224 <div
class="copyright"><?php
echo xlt('Powered by');?
> OpenEMR
</div
>
229 <div id
="wrapper" class="centerwrapper">
230 <h2
class="title"><?php
echo xlt('Patient Portal Login'); ?
></h2
>
231 <form action
="get_patient_info.php" method
="POST" onsubmit
="return process()" >
234 <td
class="algnRight"><?php
echo xlt('User Name'); ?
></td
>
235 <td
><input name
="uname" id
="uname" type
="text" autocomplete
="on" /></td
>
238 <td
class="algnRight"><?php
echo xlt('Password');?
></>
240 <input name
="pass" id
="pass" type
="password" required autocomplete
="on" /><input name
="passaddon" id
="passaddon" placeholder
="Email" type
="email" autocomplete
="on" />
244 <?php
if ($GLOBALS['language_menu_login']) { ?
>
245 <?php
if (count($result3) != 1) { ?
>
247 <td
><span
class="text"><?php
echo xlt('Language'); ?
></span
></td
>
249 <select name
=languageChoice size
="1">
251 echo "<option selected='selected' value='".htmlspecialchars($defaultLangID, ENT_QUOTES
)."'>" . htmlspecialchars(xl('Default') . " - " . xl($defaultLangName), ENT_NOQUOTES
) . "</option>\n";
252 foreach ($result3 as $iter) {
253 if ($GLOBALS['language_menu_showall']) {
254 if (!$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') {
255 continue; // skip the dummy language
258 echo "<option value='".htmlspecialchars($iter['lang_id'], ENT_QUOTES
)."'>".htmlspecialchars($iter['trans_lang_description'], ENT_NOQUOTES
)."</option>\n";
260 if (in_array($iter['lang_description'], $GLOBALS['language_menu_show'])) {
261 if (!$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') {
262 continue; // skip the dummy language
265 echo "<option value='".htmlspecialchars($iter['lang_id'], ENT_QUOTES
)."'>".htmlspecialchars($iter['trans_lang_description'], ENT_NOQUOTES
)."</option>\n";
277 <td colspan
=2><br
><center
><input type
="submit" value
="<?php echo xlt('Log In');?>" /></center
></td
>
280 <?php
if (!(empty($hiddenLanguageField))) {
281 echo $hiddenLanguageField;
285 <div
class="copyright"><?php
echo xlt('Powered by');?
> OpenEMR
</div
>
286 </div
><div
><img src
='<?php echo $GLOBALS['images_static_relative
']; ?>/logo-full-con.png'/></div
>
291 <script type
="text/javascript">
292 $
(document
).ready(function() {
294 <?php
// if something went wrong
295 if (isset($_GET['w'])) { ?
>
296 var unique_id
= $
.gritter
.add({
297 title
: '<span class="red"><?php echo xlt('Oops
!');?></span>',
298 text
: '<?php echo xlt('Something went wrong
. Please
try again
.'); ?>',
301 class_name
: 'my-nonsticky-class'
305 <?php
// if successfully logged out
306 if (isset($_GET['logout'])) { ?
>
307 var unique_id
= $
.gritter
.add({
308 title
: '<span class="green"><?php echo xlt('Success
');?></span>',
309 text
: '<?php echo xlt('You have been successfully logged out
.');?>',
312 class_name
: 'my-nonsticky-class'