5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Rod Roark <rod@sunsetsystems.com>
18 * @author Brady Miller <brady.g.miller@gmail.com>
19 * @author Kevin Yeh <kevin.y@integralemr.com>
20 * @author Scott Wakefield <scott.wakefield@gmail.com>
21 * @author ViCarePlus <visolve_emr@visolve.com>
22 * @author Julia Longtin <julialongtin@diasp.org>
25 * @link http://www.open-emr.org
30 use OpenEMR\Core\Header
;
31 use OpenEMR\Services\FacilityService
;
34 require_once("../globals.php");
36 // mdsupport - Add 'App' functionality for user interfaces without standard menu and frames
37 // If this script is called with app parameter, validate it without showing other apps.
39 // Build a list of valid entries
41 if ($GLOBALS['new_tabs_layout']) {
43 "SELECT option_id, title,is_default FROM list_options
44 WHERE list_id=? and activity=1 ORDER BY seq, option_id",
47 if (sqlNumRows($rs)) {
48 while ($app = sqlFetchArray($rs)) {
49 $app_req = explode('?', trim($app['title']));
50 if (! file_exists('../'.$app_req[0])) {
54 $emr_app [trim($app ['option_id'])] = trim($app ['title']);
55 if ($app ['is_default']) {
56 $emr_app_def = $app ['option_id'];
63 if (count($emr_app)) {
64 // Standard app must exist
65 $std_app = 'main/main_screen.php';
66 if (!in_array($std_app, $emr_app)) {
67 $emr_app['*OpenEMR'] = $std_app;
70 if (isset($_REQUEST['app']) && $emr_app[$_REQUEST['app']]) {
71 $div_app = sprintf('<input type="hidden" name="appChoice" value="%s">', attr($_REQUEST['app']));
73 foreach ($emr_app as $opt_disp => $opt_value) {
75 '<option value="%s" %s>%s</option>\n',
77 ($opt_disp == $opt_default ?
'selected="selected"' : ''),
78 text(xl_list_label($opt_disp))
84 <div id="divApp" class="form-group">
85 <label for="appChoice" class="control-label text-right">%s:</label>
87 <select class="form-control" id="selApp" name="appChoice" size="1">%s</select>
99 <meta charset
="utf-8">
100 <meta name
="viewport" content
="width=device-width, initial-scale=1, shrink-to-fit=no">
101 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge" />
103 <?php Header
::setupHeader(['jquery-ui', 'jquery-ui-darkness']); ?
>
105 <title
><?php
echo text($openemr_name) . " " . xlt('Login'); ?
></title
>
107 <link rel
="stylesheet" href
="../themes/login.css?v=<?php echo $v_js_includes; ?>" type
="text/css">
109 <link rel
="shortcut icon" href
="<?php echo $GLOBALS['images_static_relative']; ?>/favicon.ico" />
111 <script type
="text/javascript">
112 var registrationTranslations
= <?php
echo json_encode(array(
113 'title' => xla('OpenEMR Product Registration'),
114 'pleaseProvideValidEmail' => xla('Please provide a valid email address'),
115 'success' => xla('Success'),
116 'registeredSuccess' => xla('Your installation of OpenEMR has been registered'),
117 'submit' => xla('Submit'),
118 'noThanks' => xla('No Thanks'),
119 'registeredEmail' => xla('Registered email'),
120 'registeredId' => xla('Registered id'),
121 'genericError' => xla('Error. Try again later'),
126 var registrationConstants
= <?php
echo json_encode(array(
127 'webroot' => $GLOBALS['webroot']
132 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/product_registration/product_registration_service.js?v=<?php echo $v_js_includes; ?>"></script
>
133 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/product_registration/product_registration_controller.js?v=<?php echo $v_js_includes; ?>"></script
>
135 <script type
="text/javascript">
136 jQuery(document
).ready(function() {
139 var productRegistrationController
= new ProductRegistrationController();
140 productRegistrationController
.getProductRegistrationStatus(function(err
, data
) {
143 if (data
.statusAsString
=== 'UNREGISTERED') {
144 productRegistrationController
.showProductRegistrationModal();
150 $
("#authUser").focus();
153 function transmit_form() {
154 document
.forms
[0].submit();
157 function imsubmitted() {
158 <?php
if (!empty($GLOBALS['restore_sessions'])) { ?
>
159 // Delete the session cookie by setting its expiration date in the past.
160 // This forces the server to create a new session ID.
161 var olddate
= new Date();
162 olddate
.setFullYear(olddate
.getFullYear() - 1);
163 document
.cookie
= '<?php echo session_name() . '=' . session_id() ?>; path=<?php echo($web_root ? $web_root : '/');?>; expires=' + olddate
.toGMTString();
165 return false; //Currently the submit action is handled by the encrypt_form().
171 <div
class="container">
172 <form method
="POST" id
="login_form" autocomplete
="off"
173 action
="../main/main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id']); ?>"
174 target
="_top" name
="login_form" onsubmit
="return imsubmitted();">
176 <div
class="col-sm-12">
178 <div
class="center-block" style
="max-width:400px">
179 <img
class="img-fluid img-responsive center-block" src
="<?php echo $GLOBALS['images_static_relative']; ?>/login-logo.png" />
182 <input type
='hidden' name
='new_login_session_management' value
='1' />
186 $res = sqlStatement("select distinct name from `groups`");
187 for ($iter = 0; $row = sqlFetchArray($res); $iter++
) {
188 $result[$iter] = $row;
191 if (count($result) == 1) {
192 $resvalue = $result[0]{"name"};
193 echo "<input type='hidden' name='authProvider' value='" . attr($resvalue) . "' />\n";
196 // collect default language id
197 $res2 = sqlStatement("select * from lang_languages where lang_description = ?", array($GLOBALS['language_default']));
198 for ($iter = 0; $row = sqlFetchArray($res2); $iter++
) {
199 $result2[$iter] = $row;
202 if (count($result2) == 1) {
203 $defaultLangID = $result2[0]{"lang_id"};
204 $defaultLangName = $result2[0]{"lang_description"};
206 //default to english if any problems
208 $defaultLangName = "English";
211 // set session variable to default so login information appears in default language
212 $_SESSION['language_choice'] = $defaultLangID;
213 // collect languages if showing language menu
214 if ($GLOBALS['language_menu_login']) {
215 // sorting order of language titles depends on language translation options.
216 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
217 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation'])) {
218 $sql = "SELECT *,lang_description as trans_lang_description FROM lang_languages ORDER BY lang_description, lang_id";
219 $res3=SqlStatement($sql);
221 // Use and sort by the translated language name.
222 $sql = "SELECT ll.lang_id, " .
223 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
224 "ll.lang_description " .
225 "FROM lang_languages AS ll " .
226 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
227 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
229 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
230 $res3=SqlStatement($sql, array($mainLangID));
233 for ($iter = 0; $row = sqlFetchArray($res3); $iter++
) {
234 $result3[$iter] = $row;
237 if (count($result3) == 1) {
238 //default to english if only return one language
239 echo "<input type='hidden' name='languageChoice' value='1' />\n";
242 echo "<input type='hidden' name='languageChoice' value='".attr($defaultLangID)."' />\n";
245 if ($GLOBALS['login_into_facility']) {
246 $facilityService = new FacilityService();
247 $facilities = $facilityService->getAll();
248 $facilitySelected = ($GLOBALS['set_facility_cookie'] && isset($_COOKIE['pc_facility'])) ?
$_COOKIE['pc_facility'] : null;
255 <div
class="col-sm-12">
256 <?php
if (isset($_SESSION['relogin']) && ($_SESSION['relogin'] == 1)) : // Begin relogin dialog ?>
257 <div
class="alert alert-info m-1">
259 <?php
echo xlt('Password security has recently been upgraded.').' '.xlt('Please login again.'); ?
>
262 <?php
unset($_SESSION['relogin']);
264 if (isset($_SESSION['loginfailure']) && ($_SESSION['loginfailure'] == 1)) : // Begin login failure block ?>
265 <div
class="alert alert-danger login-failure m-1">
266 <?php
echo xlt('Invalid username or password'); ?
>
268 <?php
endif; // End login failure block?>
273 $extraLogo = $GLOBALS['extra_logo_login'];
274 $loginFormColumnCount = ($extraLogo == 1) ?
'6' : '12';
276 <?php
if ($extraLogo) : ?
>
277 <div
class="col-sm-6">
278 <?php
echo $logocode; ?
>
281 <div
class="col-sm-<?php echo $loginFormColumnCount;?>">
283 <div
class="center-block login-title-label">
284 <?php
if ($GLOBALS['show_label_login']) : ?
>
285 <?php
echo text($openemr_name); ?
>
289 // Figure out how to display the tiny logos
290 $t1 = $GLOBALS['tiny_logo_1'];
291 $t2 = $GLOBALS['tiny_logo_2'];
292 if ($t1 && !$t2) : ?
>
293 <div
class="col-sm-12 center-block">
294 <?php
echo $tinylogocode1; ?
>
298 if ($t2 && !$t1) : ?
>
299 <div
class="col-sm-12 center-block">
300 <?php
echo $tinylogocode2; ?
>
305 <div
class="col-sm-6 center-block"><?php
echo $tinylogocode1;?
></div
>
306 <div
class="col-sm-6 center-block"><?php
echo $tinylogocode2;?
></div
>
311 <?php
if (count($result) > 1) : // Begin Display check for groups ?>
312 <div
class="form-group">
313 <label
for="group" class="control-label text-right"><?php
echo xlt('Group:'); ?
></label
>
315 <select name
="authProvider" class="form-control">
317 foreach ($result as $iter) {
318 echo "<option value='".attr($iter{"name"})."'>".text($iter{"name"})."</option>\n";
324 <?php
endif; // End Display check for groups ?>
325 <div
class="form-group">
326 <label
for="authUser" class="control-label text-right"><?php
echo xlt('Username:'); ?
></label
>
327 <input type
="text" class="form-control" id
="authUser" name
="authUser" placeholder
="<?php echo xla('Username:'); ?>">
329 <div
class="form-group">
330 <label
for="clearPass" class="control-label text-right"><?php
echo xlt('Password:'); ?
></label
>
331 <input type
="password" class="form-control" id
="clearPass" name
="clearPass" placeholder
="<?php echo xla('Password:'); ?>">
333 <?php
echo $div_app ?
>
334 <?php
if ($GLOBALS['language_menu_login'] && (count($result3) != 1)) : // Begin language menu block ?>
335 <div
class="form-group">
336 <label
for="language" class="control-label text-right"><?php
echo xlt('Language'); ?
>:</label
>
338 <select
class="form-control" name
="languageChoice" size
="1">
340 echo "<option selected='selected' value='" . attr($defaultLangID) . "'>" . xlt('Default') . " - " . xlt($defaultLangName) . "</option>\n";
341 foreach ($result3 as $iter) :
342 if ($GLOBALS['language_menu_showall']) {
343 if (!$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') {
344 continue; // skip the dummy language
347 echo "<option value='".attr($iter['lang_id'])."'>".text($iter['trans_lang_description'])."</option>\n";
349 if (in_array($iter['lang_description'], $GLOBALS['language_menu_show'])) {
350 if (!$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') {
351 continue; // skip the dummy language
354 echo "<option value='".attr($iter['lang_id'])."'>" . text($iter['trans_lang_description']) . "</option>\n";
361 <?php
endif; // End language menu block ?>
362 <?php
if ($GLOBALS['login_into_facility']) : // Begin facilities menu block ?>
363 <div
class="form-group">
364 <label
for="facility" class="control-label text-right"><?php
echo xlt('Facility'); ?
>:</label
>
366 <select
class="form-control" name
="facility" size
="1">
367 <option value
="user_default"><?php
echo xlt('My default facility'); ?
></option
>
368 <?php
foreach ($facilities as $facility) : ?
>
369 <?php
if (!is_null($facilitySelected) && $facilitySelected == $facility['id']) : ?
>
370 <option value
="<?php echo attr($facility['id']);?>" selected
><?php
echo text($facility['name']);?
></option
>
372 <option value
="<?php echo attr($facility['id']);?>"><?php
echo text($facility['name']);?
></option
>
378 <?php
endif; // End facilities menu block ?>
379 <div
class="form-group pull-right">
380 <button type
="submit" class="btn btn-default btn-lg" onClick
="transmit_form()"><i
class="fa fa-sign-in"></i
> 
; 
;<?php
echo xlt('Login');?
></button
>
383 <div
class="col-sm-12 text-center">
385 <a href
="../../acknowledge_license_cert.html" target
="main"><?php
echo xlt('Acknowledgments, Licensing and Certification'); ?
></a
>
388 <div
class="product-registration-modal" style
="display: none">
389 <p
class="context"><?php
echo xlt("Register your installation with OEMR to receive important notifications, such as security fixes and new release announcements."); ?
></p
>
390 <input placeholder
="<?php echo xlt('email'); ?>" type
="email" class="email" style
="width: 100%; color: black" />
391 <p
class="message" style
="font-style: italic"></p
>