diff --git a/htdocs/admin/phenix.php b/htdocs/admin/phenix.php
index e4947fb0047..58582cb3a58 100644
--- a/htdocs/admin/phenix.php
+++ b/htdocs/admin/phenix.php
@@ -54,6 +54,7 @@ if ($actionsave)
$i+=dolibarr_set_const($db,'PHPPHENIX_DBNAME',trim($_POST["phpphenix_dbname"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_USER',trim($_POST["phpphenix_user"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_PASS',trim($_POST["phpphenix_pass"]),'chaine',0);
+ $i+=dolibarr_set_const($db,'PHPPHENIX_COOKIE',trim($_POST["phpphenix_cookie"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_SYNCRO',trim($_POST["phpphenix_syncro"]),'chaine',0);
$i+=dolibarr_set_const($db,'PHPPHENIX_COMPANYCREATE',trim($_POST["phpphenix_companycreate"]),'chaine',0);
@@ -206,6 +207,13 @@ print '
';
print ' | ';
print "";
+print "";
+print "| ".$langs->trans("PhenixCookie")." | ";
+print "global->PHPPHENIX_COOKIE) . "\" size=\"30\"> | ";
+print "PXlogin";
+print " | ";
+print "
";
+
print "";
print "
";
diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php
index df0a043e61d..b34ae04a77e 100644
--- a/htdocs/conf/conf.class.php
+++ b/htdocs/conf/conf.class.php
@@ -291,6 +291,7 @@ class Conf
$this->phenix->db->user=defined('PHPPHENIX_USER')?PHPPHENIX_USER:'';
$this->phenix->db->pass=defined('PHPPHENIX_PASS')?PHPPHENIX_PASS:'';
$this->phenix->db->name=defined('PHPPHENIX_DBNAME')?PHPPHENIX_DBNAME:'';
+ $this->phenix->cookie=defined('PHPPHENIX_COOKIE')?PHPPHENIX_COOKIE:'';
// Module mantis
$this->mantis->enabled=defined('MAIN_MODULE_MANTIS')?MAIN_MODULE_MANTIS:0;
$this->mantis->db->type=defined('PHPMANTIS_TYPE')?PHPMANTIS_TYPE:'__dolibarr_main_db_type__';
diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js
index 7314d41179f..c99191e7807 100644
--- a/htdocs/lib/lib_head.js
+++ b/htdocs/lib/lib_head.js
@@ -23,6 +23,12 @@ function barcode_coder_save(formNameID)
formName.submit();
}
+function formSubmit(formNameID)
+{
+ var formName = parent.document.frames['main'].document.getElementById(formNameID);
+ formName.submit();
+}
+
/*=================================================================
Purpose: Pour la fonction de saisie auto des villes
Input: postalcode,objectville
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 49782b3e036..d410b99f815 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -470,6 +470,15 @@ if (! isset($_SESSION["dol_login"]))
$user->update_last_login_date();
}
+// Module Phenix
+if ($conf->phenix->enabled && $user->phenix_login != "" && $conf->phenix->cookie)
+{
+ // Création du cookie permettant la connexion automatique, valide jusqu'à la fermeture du browser
+ if (!isset($HTTP_COOKIE_VARS[$conf->phenix->cookie]))
+ {
+ setcookie($conf->phenix->cookie, $user->phenix_login.":".$user->phenix_pass_crypted.":1", 0, "/", "", 0);
+ }
+}
// Si user admin, on force droits sur les modules base
if ($user->admin)
diff --git a/htdocs/user.class.php b/htdocs/user.class.php
index 0f0b4de79b2..23d99caa5ac 100644
--- a/htdocs/user.class.php
+++ b/htdocs/user.class.php
@@ -74,6 +74,8 @@ class User
var $fk_member;
var $webcal_login;
var $phenix_login;
+ var $phenix_pass;
+ var $phenix_pass_crypted;
var $datelastlogin;
var $datepreviouslogin;
@@ -124,7 +126,7 @@ class User
// Recupere utilisateur
$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.office_phone, u.office_fax, u.user_mobile,";
- $sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.note,";
+ $sql.= " u.admin, u.login, u.webcal_login, u.phenix_login, u.phenix_pass, u.note,";
$sql.= " u.pass, u.pass_crypted, u.pass_temp,";
$sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,";
$sql.= " u.statut, u.lang,";
@@ -181,11 +183,12 @@ class User
$this->datelastlogin = $obj->datel;
$this->datepreviouslogin = $obj->datep;
- $this->webcal_login = $obj->webcal_login;
- $this->phenix_login = $obj->phenix_login;
- $this->societe_id = $obj->fk_societe;
- $this->contact_id = $obj->fk_socpeople;
- $this->fk_member = $obj->fk_member;
+ $this->webcal_login = $obj->webcal_login;
+ $this->phenix_login = $obj->phenix_login;
+ $this->phenix_pass_crypted = $obj->phenix_pass;
+ $this->societe_id = $obj->fk_societe;
+ $this->contact_id = $obj->fk_socpeople;
+ $this->fk_member = $obj->fk_member;
if (! $this->lang) $this->lang='fr_FR';
@@ -933,6 +936,10 @@ class User
$this->note = addslashes(trim($this->note));
$this->webcal_login = addslashes(trim($this->webcal_login));
$this->phenix_login = addslashes(trim($this->phenix_login));
+ if ($this->phenix_pass != $this->phenix_pass_crypted)
+ {
+ $this->phenix_pass = md5(trim($this->phenix_pass));
+ }
$this->admin = $this->admin?$this->admin:0;
$this->db->begin();
@@ -949,6 +956,7 @@ class User
$sql.= ", email = '".$this->email."'";
$sql.= ", webcal_login = '".$this->webcal_login."'";
$sql.= ", phenix_login = '".$this->phenix_login."'";
+ $sql.= ", phenix_pass = '".$this->phenix_pass."'";
$sql.= ", note = '".$this->note."'";
$sql.= " WHERE rowid = ".$this->id;
@@ -956,27 +964,26 @@ class User
$resql = $this->db->query($sql);
if ($resql)
{
- $nbrowsaffected=$this->db->affected_rows($resql);
-
- // Mise a jour mot de passe
+ $nbrowsaffected=$this->db->affected_rows($resql);
+
+ // Mise a jour mot de passe
if ($this->pass)
{
- if ($this->pass != $this->pass_indatabase &&
- $this->pass != $this->pass_indatabase_crypted)
+ if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
{
// Si mot de passe saisi et différent de celui en base
- $this->password($user,$this->pass,$conf->password_encrypted);
-
- if (! $nbrowsaffected) $nbrowsaffected++;
- }
- }
-
- if ($nbrowsaffected)
- {
- if ($this->fk_member && ! $nosyncmember)
- {
- // This user is linked with a member, so we also update members informations
- // if this is an update.
+ $this->password($user,$this->pass,$conf->password_encrypted);
+
+ if (! $nbrowsaffected) $nbrowsaffected++;
+ }
+ }
+
+ if ($nbrowsaffected)
+ {
+ if ($this->fk_member && ! $nosyncmember)
+ {
+ // This user is linked with a member, so we also update members informations
+ // if this is an update.
$adh=new Adherent($this->db);
$result=$adh->fetch($this->fk_member);
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index 79167dd7ffa..56a09942d38 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -152,6 +152,7 @@ if ($_POST["action"] == 'add' && $canadduser)
$edituser->email = $_POST["email"];
$edituser->webcal_login = $_POST["webcal_login"];
$edituser->phenix_login = $_POST["phenix_login"];
+ $edituser->phenix_pass = $_POST["phenix_pass"];
$edituser->note = $_POST["note"];
$edituser->ldap_sid = $_POST["ldap_sid"];
@@ -244,6 +245,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield)
$edituser->email = $_POST["email"];
$edituser->webcal_login = $_POST["webcal_login"];
$edituser->phenix_login = $_POST["phenix_login"];
+ $edituser->phenix_pass = $_POST["phenix_pass"];
$ret=$edituser->update($user);
if ($ret < 0)
@@ -679,6 +681,8 @@ if (($action == 'create') || ($action == 'adduserldap'))
{
print "".'| '.$langs->trans("LoginPenix").' | ';
print ' |
';
+ print "".'| '.$langs->trans("PassPenix").' | ';
+ print ' |
';
}
print "".' |
';
@@ -954,6 +958,9 @@ else
print '| '.$langs->trans("LoginPhenix").' | ';
print ''.$fuser->phenix_login.' | ';
print "
\n";
+ print '| '.$langs->trans("PassPhenix").' | ';
+ print ''.eregi_replace('.','*',$fuser->phenix_pass_crypted).' | ';
+ print "
\n";
}
// Module Adhérent
@@ -1392,6 +1399,11 @@ else
if ($caneditfield) print '';
else print $fuser->phenix_login;
print '';
+ print "".'| '.$langs->trans("PassPhenix").' | ';
+ print '';
+ if ($caneditfield) print '';
+ else print eregi_replace('.','*',$fuser->phenix_pass_crypted);
+ print ' |
';
}
print '| ';
diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php
index 3dab8222203..9583ba199b7 100644
--- a/htdocs/user/logout.php
+++ b/htdocs/user/logout.php
@@ -34,6 +34,12 @@ include_once("../conf/conf.php");
require_once("../master.inc.php");
require_once(PEAR_PATH."/Auth/Auth.php");
+// Module Phenix
+if ($conf->phenix->enabled && $conf->phenix->cookie)
+{
+ // Destruction du cookie
+ setcookie($conf->phenix->cookie, '', 1, "/");
+}
dolibarr_syslog("End session in DOLSESSID_".$dolibarr_main_db_name);
diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql
index 3507e18d45e..92f7feea09a 100644
--- a/mysql/migration/2.1.0-2.2.0.sql
+++ b/mysql/migration/2.1.0-2.2.0.sql
@@ -931,4 +931,5 @@ INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active)
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (8, 'A5', 'Format A5', '148', '210', 'mm', 1);
INSERT INTO llx_c_paper_format (rowid, code, label, width, height, unit, active) VALUES (9, 'A6', 'Format A6', '105', '148', 'mm', 1);
-ALTER TABLE llx_user ADD COLUMN phenix_login varchar(25) after webcal_login;
\ No newline at end of file
+ALTER TABLE llx_user ADD COLUMN phenix_login varchar(25) after webcal_login;
+ALTER TABLE llx_user ADD COLUMN phenix_pass varchar(128) after phenix_login;
\ No newline at end of file
diff --git a/mysql/tables/llx_user.sql b/mysql/tables/llx_user.sql
index 56e1e27137a..516b04ea004 100644
--- a/mysql/tables/llx_user.sql
+++ b/mysql/tables/llx_user.sql
@@ -40,6 +40,7 @@ create table llx_user
admin smallint DEFAULT 0,
webcal_login varchar(25),
phenix_login varchar(25),
+ phenix_pass varchar(128),
module_comm smallint DEFAULT 1,
module_compta smallint DEFAULT 1,
fk_societe integer,
|