Commit 50957a7c authored by Mat's avatar Mat

ajoute des éléments dans le token

parent 56fd84d8
......@@ -57,10 +57,13 @@ class LettreToken
if ($user !== null) {
// TODO ici une recette secrète, hors dépôt GIT !!!
$_token = $user->getId() . '__' . $lettre->getReference();
$token = base64_encode($_token);
$token = $user->getId()
.'_'. $user->getTokenKey()
.'_'. $lettre->getId()
.'_'. $lettre->getReference();
return base64_encode($token);
return $token;
} else {
......@@ -75,12 +78,13 @@ class LettreToken
*/
public function decodePotageAccess($token)
{
$_token = base64_decode($token);
$data = explode('__', $_token);
$data = explode('_', base64_decode($token));
return array(
'id_user' => $data[0],
'ref_lettre' => $data[1]
'user_id' => $data[0],
'user_token' => $data[1],
'lettre_id' => $data[2],
'lettre_ref' => $data[3],
);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment