inserting squirrelmail alternc-changepass plugin TODO: change the changepass plugin for recent squirrelmail + alternc 3.0
This commit is contained in:
parent
c1e59f6e9a
commit
6922ef1a2d
|
@ -526,6 +526,9 @@ selenium/20120826-alternc-panel-testsuite.html -text
|
|||
selenium/README -text
|
||||
selenium/alternc.domain-local-mail-tld.html -text
|
||||
squirrelmail/Makefile -text
|
||||
squirrelmail/alternc-changepass/change.php -text
|
||||
squirrelmail/alternc-changepass/config.php -text
|
||||
squirrelmail/alternc-changepass/setup.php -text
|
||||
squirrelmail/class/m_squirrelmail.php -text
|
||||
squirrelmail/squirrelmail-install -text
|
||||
squirrelmail/templates/apache2/squirrelmail.conf -text
|
||||
|
|
|
@ -66,7 +66,8 @@ putenv("LANGUAGE=".$lang);
|
|||
setlocale(LC_ALL,$lang);
|
||||
textdomain("alternc");
|
||||
|
||||
if (_("") && preg_match("#charset=([A-Za-z0-9\.-]*)#",_(""),$mat)) {
|
||||
$empty="";
|
||||
if (_($empty) && preg_match("#charset=([A-Za-z0-9\.-]*)#",_($empty),$mat)) {
|
||||
$charset=$mat[1];
|
||||
}
|
||||
if (! isset($charset) || !$charset) $charset="UTF-8";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
all: manual.pot messages.pot */LC_MESSAGES/manual.po */LC_MESSAGES/messages.po
|
||||
|
||||
messages.pot: ../*/*.php
|
||||
messages.pot: ../*/*.php ../../squirrelmail/alternc-changepass/*.php
|
||||
[ -r $@ ] || touch $@
|
||||
xgettext --copyright-holder="AlternC Team" --package-name="AlternC" --package-version="2.0" --msgid-bugs-address="i18n@alternc.org" --force-po -o $@ --keyword=__ --keyword=_ -L PHP -F --from-code UTF-8 -j $^
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -5,3 +5,4 @@ etc/alternc/templates/javascript-common
|
|||
etc/squirrelmail
|
||||
usr/lib/alternc/install.d
|
||||
var/alternc/bureau/class
|
||||
usr/share/squirrelmail/plugins/alternc-changepass
|
||||
|
|
|
@ -20,6 +20,9 @@ case "$1" in
|
|||
dpkg-statoverride --add alternc-squirrelmail root 0750 /var/lib/squirrelmail/data
|
||||
chown -R alternc-squirrelmail:root /var/spool/squirrelmail/attach /var/lib/squirrelmail/data
|
||||
chmod -R 750 /var/spool/squirrelmail/attach /var/lib/squirrelmail/data
|
||||
# Enable the squirrelmail plugin
|
||||
squirrelmail-configure --remove-plugin alternc-changepass
|
||||
squirrelmail-configure --install-plugin alternc-changepass
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ Package: alternc-squirrelmail
|
|||
Architecture: all
|
||||
Pre-depends: debconf (>= 0.5.00) | debconf-2.0
|
||||
Depends: debianutils (>= 1.13.1), alternc (>= 1.1), squirrelmail, squirrelmail-locales, avelsieve
|
||||
Conflicts: alternc (<= 1.0.3)
|
||||
Conflicts: alternc (<= 1.0.3), alternc-changepass
|
||||
Provides: alternc-webmail
|
||||
Suggests:
|
||||
Description: Squirrelmail-Webmail plugin and configuration for AlternC
|
||||
|
|
|
@ -29,3 +29,5 @@ install:
|
|||
install -m 644 templates/apache2/squirrelmail.conf $(DESTDIR)/etc/alternc/templates/apache2/squirrelmail.conf
|
||||
# Desktop files
|
||||
install -o 1999 -g 1999 -m 644 class/m_squirrelmail.php $(DESTDIR)/var/alternc/bureau/class/
|
||||
# Squirrelmail Change Password Plugin
|
||||
install -m 644 alternc-changepass/config.php alternc-changepass/setup.php alternc-changepass/change.php $(DESTDIR)/usr/share/squirrelmail/plugins/alternc-changepass/
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
if (!$already) {
|
||||
define('SM_PATH','../../');
|
||||
|
||||
/* SquirrelMail required files. */
|
||||
require_once(SM_PATH . 'include/validate.php');
|
||||
require_once(SM_PATH . 'functions/page_header.php');
|
||||
require_once(SM_PATH . 'functions/imap.php');
|
||||
require_once(SM_PATH . 'include/load_prefs.php');
|
||||
|
||||
/* get globals */
|
||||
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;
|
||||
|
||||
|
||||
if ($_POST['acp_oldpass'] && $_POST['acp_newpass'] && $_POST['acp_verify']) {
|
||||
if ($_POST['acp_newpass']!=$_POST['acp_verify']) {
|
||||
$errstr=_("Your new passwords are differents, pleasy try again.");
|
||||
} else {
|
||||
// Check the old password
|
||||
$db->query("SELECT password FROM mail_users WHERE alias='".addslashes($username)."'");
|
||||
if (!$db->next_record()) {
|
||||
$errstr=_("Your account has not been found, please try again later or ask an administrator.");
|
||||
} else {
|
||||
if ($db->f("password")!=_md5cr($_POST['acp_oldpass'],$db->f("password"))) {
|
||||
$errstr=_("Your current password is incorrect, please try again.");
|
||||
} else {
|
||||
// If available, check the password policy :
|
||||
if (is_callable(array($admin,"checkPolicy")) &&
|
||||
!$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");
|
||||
} else {
|
||||
// ok, let's change the password
|
||||
$m=explode("@",$username,2);
|
||||
$acp_newpass=$_POST['acp_newpass'];
|
||||
$newp=_md5cr($acp_newpass);
|
||||
$un1=str_replace("@","_",$username); // version login_domain.tld
|
||||
$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 ...)");
|
||||
|
||||
// Write new cookies for the password
|
||||
$onetimepad = OneTimePadCreate(strlen($acp_newpass));
|
||||
sqsession_register($onetimepad,'onetimepad');
|
||||
$key = OneTimePadEncrypt($acp_newpass, $onetimepad);
|
||||
setcookie("key", $key, 0, $base_uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
textdomain("squirrelmail");
|
||||
|
||||
displayPageHeader($color, 'None');
|
||||
|
||||
textdomain("changepass");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($errstr) echo "<p><b>".$errstr."</b></p>";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<h2><?php __("Changing your mail password"); ?></h2>
|
||||
<form method="post" action="change.php" name="main" id="main">
|
||||
<table>
|
||||
<tr>
|
||||
<th align="right"><label for="acp_oldpass"><?php __("Old Password:"); ?></label></th>
|
||||
<td><input type="password" name="acp_oldpass" id="acp_oldpass" value="" size="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align="right"><label for="acp_newpass"><?php __("New Password:"); ?></label></th>
|
||||
<td><input type="password" name="acp_newpass" id="acp_newpass" value="" size="20" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="right"><label for="acp_verify"><?php __("Verify New Password:"); ?></label></th>
|
||||
<td><input type="password" name="acp_verify" id="acp_verify" value="" size="20" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" colspan="2"><input type="submit" value="<?php __("Change my mail password"); ?>" name="plugin_changepass" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
document.forms['main'].acp_oldpass.focus();
|
||||
document.forms['main'].setAttribute('autocomplete', 'off');
|
||||
</script>
|
||||
|
||||
|
||||
</body></html>
|
||||
<?php
|
||||
|
||||
textdomain("squirrelmail");
|
||||
|
||||
?>
|
|
@ -0,0 +1,45 @@
|
|||
<?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";
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
require_once("config.php");
|
||||
|
||||
function squirrelmail_plugin_init_alternc_changepass() {
|
||||
global $squirrelmail_plugin_hooks;
|
||||
|
||||
$squirrelmail_plugin_hooks['optpage_register_block']['alternc_changepass'] = 'alternc_changepass_optpage_register_block';
|
||||
}
|
||||
|
||||
|
||||
function alternc_changepass_optpage_register_block() {
|
||||
global $optpage_blocks;
|
||||
textdomain("changepass");
|
||||
$optpage_blocks[] = array(
|
||||
'name' => _("Change Password"),
|
||||
'url' => '../plugins/alternc_changepass/change.php',
|
||||
'desc' => _("This allow you to change your mail password."),
|
||||
'js' => false
|
||||
);
|
||||
textdomain("squirrelmail");
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in New Issue