mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
security changes: encryption is now with instead of hard coded keys
This commit is contained in:
parent
149aa8e81b
commit
14e64f4a33
|
|
@ -495,12 +495,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
$keyforid = 'DV3PH';
|
||||
$encodedid = dol_encode($id, $keyforid);
|
||||
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
||||
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
|
||||
|
||||
$keyforsecurekey = 'CGLOO';
|
||||
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$id, $keyforsecurekey);
|
||||
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
|
||||
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
|
||||
|
||||
$object->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
|
||||
|
|
|
|||
|
|
@ -79,17 +79,15 @@ $email = GETPOST("email");
|
|||
|
||||
// Getting id from Post and decoding it
|
||||
$encodedid = GETPOST('id');
|
||||
$keyforid = 'DV3PH';
|
||||
$id = dol_decode($encodedid, $keyforid);
|
||||
$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id);
|
||||
|
||||
// Getting 'securekey'.'id' from Post and decoding it
|
||||
$encodedsecurekeyandid = GETPOST('securekey', 'alpha');
|
||||
$keyforsecurekey = 'CGLOO';
|
||||
$securekeyandid = dol_decode($encodedsecurekeyandid, $keyforsecurekey);
|
||||
$securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id);
|
||||
|
||||
// Securekey decomposition into pure securekey and id added at the end
|
||||
$securekey = substr($securekeyandid, 0, strlen($securekeyandid)-strlen($id));
|
||||
$idgotfromsecurekey = substr($securekeyandid, -strlen($id), strlen($id));
|
||||
$securekey = substr($securekeyandid, 0, strlen($securekeyandid)-strlen($encodedid));
|
||||
$idgotfromsecurekey = dol_decode(substr($securekeyandid, -strlen($encodedid), strlen($encodedid)),$dolibarr_main_instance_unique_id);
|
||||
|
||||
// We check if the securekey collected is OK and if the id collected is the same than the id in the securekey
|
||||
if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecurekey != $id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user