You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.4 KiB
PHTML
95 lines
2.4 KiB
PHTML
![]()
18 years ago
|
<?php
|
||
![]()
17 years ago
|
/**
|
||
|
* Postfix Admin
|
||
|
*
|
||
|
* LICENSE
|
||
|
* This source file is subject to the GPL license that is bundled with
|
||
|
* this package in the file LICENSE.TXT.
|
||
|
*
|
||
![]()
11 years ago
|
* Further details on the project are available at http://postfixadmin.sf.net
|
||
![]()
17 years ago
|
*
|
||
|
* @version $Id$
|
||
|
* @license GNU GPL v2 or later.
|
||
|
*
|
||
|
* File: password.php
|
||
|
* Used by users to change their mailbox (and login) password.
|
||
![]()
13 years ago
|
* Template File: password.tpl
|
||
![]()
17 years ago
|
*
|
||
|
* Template Variables:
|
||
|
*
|
||
![]()
13 years ago
|
* none
|
||
![]()
17 years ago
|
*
|
||
|
* Form POST \ GET Variables:
|
||
|
*
|
||
|
* fPassword_current
|
||
|
* fPassword
|
||
|
* fPassword2
|
||
|
*/
|
||
![]()
18 years ago
|
|
||
![]()
12 years ago
|
$rel_path = '../';
|
||
![]()
17 years ago
|
require_once('../common.php');
|
||
|
|
||
|
authentication_require_role('user');
|
||
![]()
16 years ago
|
$username = authentication_get_username();
|
||
![]()
17 years ago
|
|
||
![]()
14 years ago
|
$pPassword_password_text = "";
|
||
|
$pPassword_password_current_text = "";
|
||
|
|
||
![]()
18 years ago
|
if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||
|
{
|
||
![]()
8 years ago
|
if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!');
|
||
|
|
||
![]()
17 years ago
|
if(isset($_POST['fCancel'])) {
|
||
|
header("Location: main.php");
|
||
|
exit(0);
|
||
|
}
|
||
|
|
||
![]()
16 years ago
|
$fPassword_current = $_POST['fPassword_current'];
|
||
|
$fPassword = $_POST['fPassword'];
|
||
|
$fPassword2 = $_POST['fPassword2'];
|
||
![]()
17 years ago
|
|
||
![]()
14 years ago
|
$error = 0;
|
||
![]()
13 years ago
|
|
||
|
$validpass = validate_password($fPassword);
|
||
|
if(count($validpass) > 0) {
|
||
|
flash_error($validpass[0]); # TODO: honor all error messages, not only the first one
|
||
![]()
14 years ago
|
$error += 1;
|
||
![]()
17 years ago
|
}
|
||
![]()
11 years ago
|
|
||
|
$mh = new MailboxHandler;
|
||
|
|
||
|
if(!$mh->login($username, $fPassword_current)) {
|
||
![]()
16 years ago
|
$error += 1;
|
||
|
$pPassword_password_current_text = $PALANG['pPassword_password_current_text_error'];
|
||
![]()
17 years ago
|
}
|
||
|
if (empty ($fPassword) or ($fPassword != $fPassword2))
|
||
|
{
|
||
![]()
14 years ago
|
$error += 1;
|
||
![]()
17 years ago
|
$pPassword_password_text = $PALANG['pPassword_password_text_error'];
|
||
|
}
|
||
![]()
18 years ago
|
|
||
![]()
14 years ago
|
if ($error == 0)
|
||
![]()
17 years ago
|
{
|
||
![]()
13 years ago
|
$mh->init($username); # TODO: error handling
|
||
|
if($mh->change_pw($fPassword, $fPassword_current) ) {
|
||
![]()
10 years ago
|
flash_info(Config::Lang_f('pPassword_result_success', $username));
|
||
![]()
17 years ago
|
header("Location: main.php");
|
||
|
exit(0);
|
||
![]()
17 years ago
|
}
|
||
|
else
|
||
|
{
|
||
![]()
10 years ago
|
flash_error(Config::Lang_f('pPassword_result_error', $username));
|
||
![]()
17 years ago
|
}
|
||
|
}
|
||
![]()
18 years ago
|
}
|
||
![]()
17 years ago
|
|
||
![]()
13 years ago
|
$smarty->assign ('SESSID_USERNAME', $username);
|
||
![]()
15 years ago
|
$smarty->assign ('pPassword_password_current_text', $pPassword_password_current_text, false);
|
||
|
$smarty->assign ('pPassword_password_text', $pPassword_password_text, false);
|
||
![]()
15 years ago
|
|
||
![]()
13 years ago
|
$smarty->assign ('smarty_template', 'password');
|
||
![]()
15 years ago
|
$smarty->display ('index.tpl');
|
||
![]()
17 years ago
|
|
||
|
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
||
![]()
18 years ago
|
?>
|