Verified Commit 52c35aff authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Orchestrator) - url is being sent properly

save commit - timetamp to unix.
2 merge requests!72Releasing Fusiondirectory Orchestrator 1.1,!61Resolve "[Orchestrator] - New endpoint for userReminder allowing to send notification to use with token to extend their account longevity"
Pipeline #30335 failed with stages
in 1 minute and 19 seconds
Showing with 6 additions and 2 deletions
+6 -2
......@@ -215,10 +215,14 @@ class Reminder implements EndpointInterface
* @return bool
* @throws Exception
*/
private function saveTokenInLdap (string $userDN, string $token, int $timeStamp): bool
private function saveTokenInLdap (string $userDN, string $token, int $days): bool
{
$result = FALSE;
$currentTimestamp = time();
// Calculate the future timestamp by adding days to the current timestamp (We actually adds number of seconds).
$futureTimestamp = $currentTimestamp + ($days * 24 * 60 * 60);
preg_match('/uid=([^,]+),ou=/', $userDN, $matches);
$uid = $matches[1];
$dn = 'cn=' . $uid . ',' . 'ou=tokens' . ',' . $_ENV["LDAP_BASE"];
......@@ -227,7 +231,7 @@ class Reminder implements EndpointInterface
$ldap_entry["fdTokenUserDN"] = $userDN;
$ldap_entry["fdTokenType"] = 'reminder';
$ldap_entry["fdToken"] = $token;
$ldap_entry["fdTokenTimestamp"] = $timeStamp;
$ldap_entry["fdTokenTimestamp"] = $futureTimestamp;
$ldap_entry["cn"] = $uid;
// set the dn for the token, only take what's between "uid=" and ",ou="
......
Supports Markdown
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