adding alternc-changepass new plugin version, TO BE TESTED
This commit is contained in:
parent
7e017eb2c7
commit
491ab501a7
|
@ -544,12 +544,12 @@ selenium/README -text
|
||||||
selenium/alternc.domain-local-mail-tld.html -text
|
selenium/alternc.domain-local-mail-tld.html -text
|
||||||
squirrelmail/Makefile -text
|
squirrelmail/Makefile -text
|
||||||
squirrelmail/alternc-changepass/change.php -text
|
squirrelmail/alternc-changepass/change.php -text
|
||||||
squirrelmail/alternc-changepass/config.php -text
|
|
||||||
squirrelmail/alternc-changepass/setup.php -text
|
squirrelmail/alternc-changepass/setup.php -text
|
||||||
squirrelmail/class/m_squirrelmail.php -text
|
squirrelmail/class/m_squirrelmail.php -text
|
||||||
squirrelmail/squirrelmail-install -text
|
squirrelmail/squirrelmail-install -text
|
||||||
squirrelmail/templates/apache2/squirrelmail.conf -text
|
squirrelmail/templates/apache2/squirrelmail.conf -text
|
||||||
squirrelmail/templates/javascript-common/javascript-common.conf -text
|
squirrelmail/templates/javascript-common/javascript-common.conf -text
|
||||||
|
squirrelmail/templates/squirrelmail/alternc-changepass.conf -text
|
||||||
squirrelmail/templates/squirrelmail/apache.conf -text
|
squirrelmail/templates/squirrelmail/apache.conf -text
|
||||||
squirrelmail/templates/squirrelmail/avelsieve-config.php -text
|
squirrelmail/templates/squirrelmail/avelsieve-config.php -text
|
||||||
src/Makefile -text
|
src/Makefile -text
|
||||||
|
|
|
@ -1,51 +1,69 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!$already) {
|
@include_once("/etc/squirrelmail/alternc-changepass.conf");
|
||||||
define('SM_PATH','../../');
|
if (!defined("ALTERNC_LOC")) {
|
||||||
|
echo "No AlternC-Changepass configuration, please setup alternc-changepass plugin in /etc/squirrelmail/";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
bindtextdomain("alternc-changepass", ALTERNC_LOC."/bureau/locales");
|
||||||
|
|
||||||
|
$link=mysql_connect(
|
||||||
|
ALTERNC_CHANGEPASS_MYSQL_HOST,
|
||||||
|
ALTERNC_CHANGEPASS_MYSQL_USER,
|
||||||
|
ALTERNC_CHANGEPASS_MYSQL_PASSWORD
|
||||||
|
);
|
||||||
|
if ($link) {
|
||||||
|
mysql_select_db(ALTERNC_CHANGEPASS_MYSLQ_DB);
|
||||||
|
} else {
|
||||||
|
__("Can't connect to MySQL server on AlternC!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define('SM_PATH','../../');
|
||||||
|
|
||||||
/* SquirrelMail required files. */
|
/* SquirrelMail required files. */
|
||||||
require_once(SM_PATH . 'include/validate.php');
|
require_once(SM_PATH . 'include/validate.php');
|
||||||
require_once(SM_PATH . 'functions/page_header.php');
|
require_once(SM_PATH . 'functions/page_header.php');
|
||||||
require_once(SM_PATH . 'functions/imap.php');
|
require_once(SM_PATH . 'functions/imap.php');
|
||||||
require_once(SM_PATH . 'include/load_prefs.php');
|
require_once(SM_PATH . 'include/load_prefs.php');
|
||||||
|
|
||||||
/* get globals */
|
/* get globals */
|
||||||
sqgetGlobalVar('username', $username, SQ_SESSION);
|
sqgetGlobalVar('username', $username, SQ_SESSION);
|
||||||
|
|
||||||
require_once (SM_PATH . "plugins/alternc_changepass/config.php");
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
textdomain("changepass");
|
|
||||||
|
|
||||||
global $username, $base_uri, $key, $onetimepad ,$admin, $classes, $mail, $err;
|
require_once (SM_PATH . "plugins/alternc_changepass/config.php");
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
textdomain("alternc-changepass");
|
||||||
|
|
||||||
|
global $username, $base_uri, $key, $onetimepad;
|
||||||
|
|
||||||
|
list($login,$domain)=explode("@",$username,2);
|
||||||
|
|
||||||
if ($_POST['acp_oldpass'] && $_POST['acp_newpass'] && $_POST['acp_verify']) {
|
if ($_POST['acp_oldpass'] && $_POST['acp_newpass'] && $_POST['acp_verify']) {
|
||||||
if ($_POST['acp_newpass']!=$_POST['acp_verify']) {
|
if ($_POST['acp_newpass']!=$_POST['acp_verify']) {
|
||||||
$errstr=_("Your new passwords are differents, pleasy try again.");
|
$errstr=_("Your new passwords are differents, pleasy try again.");
|
||||||
} else {
|
} else {
|
||||||
// Check the old password
|
// Check the old password
|
||||||
$db->query("SELECT password FROM mail_users WHERE alias='".addslashes($username)."'");
|
$r=mysql_query("SELECT a.password FROM address a,domaines d WHERE a.address='".addslashes($login)."' AND a.dom_id=d.id AND d.domaine='".addslashes($domain)."';");
|
||||||
if (!$db->next_record()) {
|
if (!($c=mysql_fetch_array($r))) {
|
||||||
$errstr=_("Your account has not been found, please try again later or ask an administrator.");
|
$errstr=_("Your account has not been found, please try again later or ask an administrator.");
|
||||||
} else {
|
} else {
|
||||||
if ($db->f("password")!=_md5cr($_POST['acp_oldpass'],$db->f("password"))) {
|
if ($c["password"]!=_md5cr($_POST['acp_oldpass'],$c["password"])) {
|
||||||
$errstr=_("Your current password is incorrect, please try again.");
|
$errstr=_("Your current password is incorrect, please try again.");
|
||||||
} else {
|
} else {
|
||||||
// If available, check the password policy :
|
// FIXME DO Check the password policy :
|
||||||
|
/*
|
||||||
if (is_callable(array($admin,"checkPolicy")) &&
|
if (is_callable(array($admin,"checkPolicy")) &&
|
||||||
!$admin->checkPolicy("pop",$username,$_POST['acp_newpass'])) {
|
!$admin->checkPolicy("pop",$username,$_POST['acp_newpass'])) {
|
||||||
$errstr=_("This password is not strong enough for your policy, set a stronger password or call your administrator");
|
$errstr=_("This password is not strong enough for your policy, set a stronger password or call your administrator");
|
||||||
} else {
|
} else {
|
||||||
|
*/
|
||||||
// ok, let's change the password
|
// ok, let's change the password
|
||||||
$m=explode("@",$username,2);
|
|
||||||
$acp_newpass=$_POST['acp_newpass'];
|
$acp_newpass=$_POST['acp_newpass'];
|
||||||
$newp=_md5cr($acp_newpass);
|
$newp=_md5cr($acp_newpass);
|
||||||
$un1=str_replace("@","_",$username); // version login_domain.tld
|
mysql_query("UPDATE address SET password='".addslashes($newp)."' WHERE id=".$c["id"]." ;");
|
||||||
$un2=substr($un1,0,strlen($un1)-strlen(strrchr($un1,"_")))."@".substr(strrchr($un1,"_"),1); // version login@domain.tld
|
|
||||||
$db->query("UPDATE mail_users SET password='$newp' WHERE alias='$un1' or alias='$un2';");
|
|
||||||
|
|
||||||
$errstr=_("Your password has been successfully changed. Don't forget to change it in your mail software if you are using one (Outlook, Mozilla, Thunderbird, Eudora ...)");
|
$errstr=_("Your password has been successfully changed. Don't forget to change it in your mail software if you are using one (Outlook, Mozilla, Thunderbird, Eudora ...)");
|
||||||
|
|
||||||
// Write new cookies for the password
|
// Write new cookies for the password
|
||||||
|
@ -53,27 +71,23 @@ if ($_POST['acp_oldpass'] && $_POST['acp_newpass'] && $_POST['acp_verify']) {
|
||||||
sqsession_register($onetimepad,'onetimepad');
|
sqsession_register($onetimepad,'onetimepad');
|
||||||
$key = OneTimePadEncrypt($acp_newpass, $onetimepad);
|
$key = OneTimePadEncrypt($acp_newpass, $onetimepad);
|
||||||
setcookie("key", $key, 0, $base_uri);
|
setcookie("key", $key, 0, $base_uri);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // POSTED data ?
|
||||||
|
|
||||||
|
|
||||||
textdomain("squirrelmail");
|
textdomain("squirrelmail");
|
||||||
|
|
||||||
displayPageHeader($color, 'None');
|
displayPageHeader($color, 'None');
|
||||||
|
|
||||||
textdomain("changepass");
|
textdomain("alternc-changepass");
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($errstr) echo "<p><b>".$errstr."</b></p>";
|
if ($errstr) echo "<p><b>".$errstr."</b></p>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<h2><?php __("Changing your mail password"); ?></h2>
|
<h2><?php __("Changing your mail password"); ?></h2>
|
||||||
<form method="post" action="change.php" name="main" id="main">
|
<form method="post" action="change.php" name="main" id="main">
|
||||||
<table>
|
<table>
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
bindtextdomain("changepass", "/var/alternc/bureau/locales");
|
|
||||||
|
|
||||||
$do_not_set_lang_env=1;
|
|
||||||
$root="/var/alternc/bureau/";
|
|
||||||
|
|
||||||
global $L_MYSQL_HOST,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$L_MYSQL_PWD;
|
|
||||||
|
|
||||||
require_once($root."class/local.php");
|
|
||||||
require_once($root."class/functions.php");
|
|
||||||
require_once($root."class/m_err.php");
|
|
||||||
|
|
||||||
global $er,$fe,$username,$db, $admin, $classes, $mail, $err;
|
|
||||||
|
|
||||||
require_once($root."class/db_mysql.php");
|
|
||||||
|
|
||||||
if (!class_exists("DB_system")) {
|
|
||||||
|
|
||||||
// Classe héritée de la classe db de la phplib.
|
|
||||||
class DB_system extends DB_Sql {
|
|
||||||
var $Host,$Database,$User,$Password;
|
|
||||||
function DB_system() {
|
|
||||||
global $L_MYSQL_HOST,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$L_MYSQL_PWD;
|
|
||||||
$this->Host = $L_MYSQL_HOST;
|
|
||||||
$this->Database = $L_MYSQL_DATABASE;
|
|
||||||
$this->User = $L_MYSQL_LOGIN;
|
|
||||||
$this->Password = $L_MYSQL_PWD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$db= new DB_system();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$err=new m_err();
|
|
||||||
|
|
||||||
require_once($root."class/m_admin.php");
|
|
||||||
$admin=new m_admin();
|
|
||||||
$classes[]="admin";
|
|
||||||
require_once($root."class/m_mail.php");
|
|
||||||
$mail=new m_mail();
|
|
||||||
$classes[]="mail";
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,21 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once("config.php");
|
@include_once("/etc/squirrelmail/alternc-changepass.conf");
|
||||||
|
bindtextdomain("alternc-changepass", ALTERNC_LOC."/bureau/locales");
|
||||||
|
|
||||||
function squirrelmail_plugin_init_alternc_changepass() {
|
function squirrelmail_plugin_init_alternc_changepass() {
|
||||||
global $squirrelmail_plugin_hooks;
|
global $squirrelmail_plugin_hooks;
|
||||||
|
|
||||||
$squirrelmail_plugin_hooks['optpage_register_block']['alternc_changepass'] = 'alternc_changepass_optpage_register_block';
|
$squirrelmail_plugin_hooks['optpage_register_block']['alternc_changepass'] = 'alternc_changepass_optpage_register_block';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function alternc_changepass_optpage_register_block() {
|
function alternc_changepass_optpage_register_block() {
|
||||||
global $optpage_blocks;
|
global $optpage_blocks;
|
||||||
textdomain("changepass");
|
textdomain("alternc-changepass");
|
||||||
$optpage_blocks[] = array(
|
$optpage_blocks[] = array(
|
||||||
'name' => _("Change Password"),
|
'name' => _("Change Password"),
|
||||||
'url' => '../plugins/alternc_changepass/change.php',
|
'url' => '../plugins/alternc_changepass/change.php',
|
||||||
'desc' => _("This allow you to change your mail password."),
|
'desc' => _("Change the password of your email account."),
|
||||||
'js' => false
|
'js' => false
|
||||||
);
|
);
|
||||||
textdomain("squirrelmail");
|
textdomain("squirrelmail");
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
// This is the configuration file of AlternC-changepass plugin for Squirrelmail
|
||||||
|
define("ALTERNC_CHANGEPASS_LOC","/var/alternc");
|
||||||
|
define("ALTERNC_CHANGEPASS_MYSQL_HOST","localhost");
|
||||||
|
define("ALTERNC_CHANGEPASS_MYSQL_USER","2000_squirrelmail");
|
||||||
|
define("ALTERNC_CHANGEPASS_MYSQL_PASSWORD","een3ooCi");
|
||||||
|
define("ALTERNC_CHANGEPASS_MYSQL_DB","alternc");
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue