Commit 378b171f authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch...

Merge branch '5726-erreur-lors-de-l-envoi-du-second-mail-de-relance-avec-argonaut-user-reminder' into 'argonaut-1.3-dev'

Resolve "erreur lors de l'envoi du second mail de relance avec argonaut-user-reminder"

See merge request argonaut/argonaut!79
parents fbc14098 5e4e400e
......@@ -303,6 +303,9 @@ sub alert_user_if_needed
if ((defined $token_datetime) && ($token_datetime + ($config->{'resend_delay'} * 86400) > $now)) {
print "User $cn was already sent a mail, not resending yet.\n" if $verbose;
return;
} elsif ((defined $token_hash) || (defined $token_datetime)) {
# Delete obsolete token so we may create it again
delete_ldap_token($ldap, $entry->get_value('uid'));
}
my ($manager_cn, $manager_mail);
......@@ -394,6 +397,16 @@ sub get_ldap_token
}
}
sub delete_ldap_token
{
my ($ldap, $uid) = @_;
my $dn = "ou=$uid,".$config->{'token_rdn'}.','.$config->{'fd_rdn'}.','.$config->{'ldap_base'};
my $mesg = $ldap->delete($dn);
$mesg->code && warn "! failed to delete token $dn: ".$mesg->error."\n";
}
sub store_ldap_token
{
my ($ldap, $uid, $datetime) = @_;
......@@ -421,7 +434,7 @@ sub store_ldap_token
]
);
$mesg->code && die "! failed to add LDAP's $dn token: ".$mesg->error."\n";
$mesg->code && die "! failed to create token $dn: ".$mesg->error."\n";
return $token_password;
}
......
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