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;
58 if (count($result2) == 1) {
59 $defaultLangID = $result2[0]{"lang_id"};
60 $defaultLangName = $result2[0]{"lang_description"};
63 //default to english if any problems
65 $defaultLangName = "English";
67 // set session variable to default so login information appears in default language
68 $_SESSION['language_choice'] = $defaultLangID;
69 // collect languages if showing language menu
70 if ($GLOBALS['language_menu_login']) {
71 // sorting order of language titles depends on language translation options.
72 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
73 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation'])) {
74 $sql = "SELECT * FROM lang_languages ORDER BY lang_description, lang_id";
75 $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) );
89 for ($iter = 0;$row = sqlFetchArray($res3);$iter++
) {
90 $result3[$iter] = $row;
92 if (count($result3) == 1) {
93 //default to english if only return one language
94 $hiddenLanguageField = "<input type='hidden' name='languageChoice' value='1' />\n";
98 $hiddenLanguageField = "<input type='hidden' name='languageChoice' value='".htmlspecialchars($defaultLangID,ENT_QUOTES
)."' />\n";
106 <title
><?php
echo xlt('Patient Portal Login'); ?
></title
>
108 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-11-3/index.js"></script
>
109 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery.gritter-1-7-4/js/jquery.gritter.min.js"></script
>
111 <link rel
="stylesheet" type
="text/css" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery.gritter-1-7-4/css/jquery.gritter.css" />
112 <link rel
="stylesheet" type
="text/css" href
="assets/css/base.css?v=<?php echo $v_js_includes; ?>" />
114 <script type
="text/javascript">
118 alert ('<?php echo addslashes( xl('Field(s
) are missing
!') ); ?>');
122 function validate() {
124 if (document
.getElementById('uname').value
== "") {
125 document
.getElementById('uname').style
.border
= "1px solid red";
128 if (document
.getElementById('pass').value
== "") {
129 document
.getElementById('pass').style
.border
= "1px solid red";
134 function process_new_pass() {
136 if (!(validate_new_pass())) {
137 alert ('<?php echo addslashes( xl('Field(s
) are missing
!') ); ?>');
140 if (document
.getElementById('pass_new').value
!= document
.getElementById('pass_new_confirm').value
) {
141 alert ('<?php echo addslashes( xl('The
new password fields are not the same
.') ); ?>');
144 if (document
.getElementById('pass').value
== document
.getElementById('pass_new').value
) {
145 alert ('<?php echo addslashes( xl('The
new password can not be the same
as the current password
.') ); ?>');
150 function validate_new_pass() {
152 if (document
.getElementById('uname').value
== "") {
153 document
.getElementById('uname').style
.border
= "1px solid red";
156 if (document
.getElementById('pass').value
== "") {
157 document
.getElementById('pass').style
.border
= "1px solid red";
160 if (document
.getElementById('pass_new').value
== "") {
161 document
.getElementById('pass_new').style
.border
= "1px solid red";
164 if (document
.getElementById('pass_new_confirm').value
== "") {
165 document
.getElementById('pass_new_confirm').style
.border
= "1px solid red";
171 <style type
="text/css">
173 font
-family
: sans
-serif
;
174 background
-color
: #638fd0;
176 background
: -webkit
-radial
-gradient(circle
, white
, #638fd0);
177 background
: -moz
-radial
-gradient(circle
, white
, #638fd0);
188 <?php
if (isset($_SESSION['password_update'])||
isset($_GET['password_update'])) {
189 $_SESSION['password_update']=1;
191 <div id
="wrapper" class="centerwrapper">
192 <h2
class="title"><?php
echo xlt('Please Enter a New Password'); ?
></h2
>
193 <form action
="get_patient_info.php" method
="POST" onsubmit
="return process_new_pass()" >
196 <td
class="algnRight"><?php
echo xlt('User Name'); ?
></td
>
197 <td
><input name
="uname" id
="uname" type
="text" autocomplete
="off" value
="<?php echo attr($_SESSION['portal_username']); ?>"/></td
>
200 <td
class="algnRight"><?php
echo xlt('Current Password');?
></>
202 <input name
="pass" id
="pass" type
="password" autocomplete
="off" />
206 <td
class="algnRight"><?php
echo xlt('New Password');?
></>
208 <input name
="pass_new" id
="pass_new" type
="password" />
212 <td
class="algnRight"><?php
echo xlt('Confirm New Password');?
></>
214 <input name
="pass_new_confirm" id
="pass_new_confirm" type
="password" />
218 <td colspan
=2><br
><center
><input type
="submit" value
="<?php echo xlt('Log In');?>" /></center
></td
>
223 <div
class="copyright"><?php
echo xlt('Powered by');?
> OpenEMR
</div
>
228 <div id
="wrapper" class="centerwrapper">
229 <h2
class="title"><?php
echo xlt('Patient Portal Login'); ?
></h2
>
230 <form action
="get_patient_info.php" method
="POST" onsubmit
="return process()" >
233 <td
class="algnRight"><?php
echo xlt('User Name'); ?
></td
>
234 <td
><input name
="uname" id
="uname" type
="text" autocomplete
="on" /></td
>
237 <td
class="algnRight"><?php
echo xlt('Password');?
></>
239 <input name
="pass" id
="pass" type
="password" required autocomplete
="on" /><input name
="passaddon" id
="passaddon" placeholder
="Email" type
="email" autocomplete
="on" />
243 <?php
if ($GLOBALS['language_menu_login']) { ?
>
244 <?php
if (count($result3) != 1) { ?
>
246 <td
><span
class="text"><?php
echo xlt('Language'); ?
></span
></td
>
248 <select name
=languageChoice size
="1">
250 echo "<option selected='selected' value='".htmlspecialchars($defaultLangID,ENT_QUOTES
)."'>" . htmlspecialchars( xl('Default') . " - " . xl($defaultLangName), ENT_NOQUOTES
) . "</option>\n";
251 foreach ($result3 as $iter) {
252 if ($GLOBALS['language_menu_showall']) {
253 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
254 echo "<option value='".htmlspecialchars($iter['lang_id'],ENT_QUOTES
)."'>".htmlspecialchars($iter['trans_lang_description'],ENT_NOQUOTES
)."</option>\n";
257 if (in_array($iter['lang_description'], $GLOBALS['language_menu_show'])) {
258 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
259 echo "<option value='".htmlspecialchars($iter['lang_id'],ENT_QUOTES
)."'>".htmlspecialchars($iter['trans_lang_description'],ENT_NOQUOTES
)."</option>\n";
270 <td colspan
=2><br
><center
><input type
="submit" value
="<?php echo xlt('Log In');?>" /></center
></td
>
273 <?php
if (!(empty($hiddenLanguageField))) echo $hiddenLanguageField; ?
>
276 <div
class="copyright"><?php
echo xlt('Powered by');?
> OpenEMR
</div
>
277 </div
><div
><img src
='<?php echo $GLOBALS['images_static_relative
']; ?>/logo-full-con.png'/></div
>
282 <script type
="text/javascript">
283 $
(document
).ready(function() {
285 <?php
// if something went wrong
286 if (isset($_GET['w'])) { ?
>
287 var unique_id
= $
.gritter
.add({
288 title
: '<span class="red"><?php echo xlt('Oops
!');?></span>',
289 text
: '<?php echo xlt('Something went wrong
. Please
try again
.'); ?>',
292 class_name
: 'my-nonsticky-class'
296 <?php
// if successfully logged out
297 if (isset($_GET['logout'])) { ?
>
298 var unique_id
= $
.gritter
.add({
299 title
: '<span class="green"><?php echo xlt('Success
');?></span>',
300 text
: '<?php echo xlt('You have been successfully logged out
.');?>',
303 class_name
: 'my-nonsticky-class'