Ejemplo n.º 1
0
/**
 * Show confirmation of change password and actually change password
 */
function doChangePassword($confirm, $msg = '')
{
    global $data, $misc;
    global $lang, $conf;
    $server_info = $misc->getServerInfo();
    if ($confirm) {
        $_REQUEST['user'] = $server_info['username'];
        $misc->printTrail('user');
        $misc->printTitle($lang['strchangepassword'], 'pg.user.alter');
        $misc->printMsg($msg);
        if (!isset($_POST['password'])) {
            $_POST['password'] = '';
        }
        if (!isset($_POST['confirm'])) {
            $_POST['confirm'] = '';
        }
        echo "<form action=\"users.php\" method=\"post\">\n";
        echo "<table>\n";
        echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strpassword']}</th>\n";
        echo "\t\t<td><input type=\"password\" name=\"password\" size=\"32\" value=\"", htmlspecialchars($_POST['password']), "\" /></td>\n\t</tr>\n";
        echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strconfirm']}</th>\n";
        echo "\t\t<td><input type=\"password\" name=\"confirm\" size=\"32\" value=\"\" /></td>\n\t</tr>\n";
        echo "</table>\n";
        echo "<p><input type=\"hidden\" name=\"action\" value=\"changepassword\" />\n";
        echo $misc->form;
        echo "<input type=\"submit\" name=\"ok\" value=\"{$lang['strok']}\" />\n";
        echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
        echo "</p></form>\n";
    } else {
        // Check that password is minimum length
        if (strlen($_POST['password']) < $conf['min_password_length']) {
            doChangePassword(true, $lang['strpasswordshort']);
        } elseif ($_POST['password'] != $_POST['confirm']) {
            doChangePassword(true, $lang['strpasswordconfirm']);
        } else {
            $status = $data->changePassword($server_info['username'], $_POST['password']);
            if ($status == 0) {
                doAccount($lang['strpasswordchanged']);
            } else {
                doAccount($lang['strpasswordchangedbad']);
            }
        }
    }
}
Ejemplo n.º 2
0
    // update password in database
    $result = $config['user']->ChangePassword(md5($password));
    // successful change
    if ($result !== FALSE) {
        // password has been changed
        $_SESSION['Temp Pass'] = FALSE;
        $lastpage = getLastPage();
        if (strpos($lastpage, 'login') !== FALSE || strpos($lastpage, 'changepass') !== FALSE) {
            $lastpage = './';
        }
        ForwardTo($lastpage);
        exit;
    }
    return FALSE;
}
doChangePassword();
function RenderPage_changepass()
{
    global $config, $html;
    $config['title'] = 'Change Password';
    $html->setPageFrame('basic');
    // load page html
    $html->LoadCss('login.css');
    $outputs = RenderHTML::LoadHTML('pages/changepass.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // display error
    $messages = '';
    if (isset($_SESSION['error'])) {
  <div class="content">
    <div class="content_resize">
      <div class="mainbar">
        <div class="article">
          
        </div>
      </div>
    </div>
</div>  

<?php 
require_once './library/config.php';
require_once './library/functions.php';
$errorMessage = '&nbsp;';
if (isset($_POST['txtUserName'])) {
    $result = doChangePassword();
    if ($result != '') {
        $errorMessage = $result;
    }
}
?>


<br/>
<br/>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="1" class="graybox">
 <tr> 
  
 </tr>
 <tr> 
  <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="20">