3 * Display a message indicating that the user's password has/will expire.
6 * @link http://www.open-emr.org
7 * @author ViCarePlus Team, Visolve <vicareplus_engg@visolve.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2010 ViCarePlus Team, Visolve <vicareplus_engg@visolve.com>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
17 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
22 $q = $_SESSION["authUserID"];
23 $result = sqlStatement("select username, pwd_expiration_date from users where id = ?", array($q));
24 if ($row = sqlFetchArray($result)) {
25 $pwd_expires = $row['pwd_expiration_date'];
26 $username = $row['username'];
29 $current_date = date("Y-m-d");
30 $grace_time = date("Y-m-d", strtotime($pwd_expires . "+" . $GLOBALS['password_grace_time'] . "days"));
31 $pwd_alert = date("Y-m-d", strtotime($pwd_expires . "-7 days"));
34 // Determine the expiration message to display
35 if (($pwd_expires == "0000-00-00") or ($pwd_expires == "")) {
36 $msg_alert = xl("Your Password Expired. Please change your password.");
38 } else if ((strtotime($current_date) > strtotime($pwd_expires)) && ($grace_time != "") &&
39 ($pwd_expires != "") && (strtotime($current_date) < strtotime($grace_time))) {
40 //display warning if user is in grace period to change password
41 $msg_alert = xl("You are in Grace Login period. Change your password before")." ".$grace_time;
43 } else if (strtotime($pwd_expires) == strtotime($current_date)) {
44 // Display warning if password expires on current day
45 $msg_alert = xl("Your Password Expires today. Please change your password.");
47 } else if ((strtotime($current_date) >= strtotime($pwd_alert)) && strtotime($pwd_alert) != "") {
48 // Display a notice that password expires soon
49 $msg_alert = xl("Your Password Expires on")." ".$pwd_expires.". ".xl("Please change your password.");
57 <meta http
-equiv
="Content-Language" content
="en-us">
58 <?php
html_header_show();?
>
59 <link rel
='stylesheet' href
="<?php echo $css_header;?>" type
="text/css">
61 <body
class="body_bottom">
63 <br
/><br
/><br
/><span
class="pwdalert <?php echo attr($case); ?>">
64 <table align
="center" >
68 <td rowspan
="3"><?php
echo xlt("Welcome");
69 echo " ".text($username);?
>,<br
>
71 <?php
echo text($msg_alert);?
>