self-service-password icon indicating copy to clipboard operation
self-service-password copied to clipboard

Notify by mail code factorization

Open artlog opened this issue 3 years ago • 1 comments

Current implementation of mail selected for notification is duplicated over each activity ( ie change.php changesshkey.php resetbyquestions.php resetbytoken.php adminchangepassword.php changepassword.php )

Having a unique implementation of it would simplify maintenance and expandability

artlog avatar Jul 05 '22 14:07 artlog

See if we can resolve this before closing this issue: https://github.com/ltb-project/self-service-password/pull/675#issuecomment-1181809461

coudot avatar Jul 12 '22 14:07 coudot

Seems everything discussed in this issue is done in #675

I think we can close this safely @coudot ?

davidcoutadeur avatar Apr 25 '24 09:04 davidcoutadeur

We still have this: https://github.com/ltb-project/self-service-password/pull/675#issuecomment-1181809461

But I'm not sure to be able to work on it before 1.6 release

coudot avatar Apr 25 '24 09:04 coudot

I can give a look

davidcoutadeur avatar Apr 25 '24 12:04 davidcoutadeur

I have proposed a simple improvement in PR https://github.com/ltb-project/self-service-password/pull/893

Ideally, it would be a good idea to have a deeper refactoring here.

For example, it would be nice to split the ltb-ldap functions differently, in order to:

1/ also factorize: https://github.com/ltb-project/self-service-password/blob/7a517ab272ba0afb731cb7e2e5c8930135d3aa81/htdocs/sendtoken.php#L107

                            # Match with user submitted values
                            foreach ($mailValues as $mailValue) {
                                if (strcasecmp($mail_attribute, "proxyAddresses") == 0) {
                                    $mailValue = str_ireplace("smtp:", "", $mailValue);
                                }
                                if (strcasecmp($mail, $mailValue) == 0) {
                                    $match = true;
                                }
                            }

2/ at line https://github.com/ltb-project/self-service-password/blob/9b6e249936c20facc592206c09b76b267033cd72/htdocs/sendtoken.php#L117 : don't call the \Ltb\AttributeValue::ldap_get_first_available_value part, which is doing another LDAP request, but only do the attribute value manipulation part.

davidcoutadeur avatar Apr 25 '24 14:04 davidcoutadeur

Thanks for the job. I think it's enough for the moment.

We may work on improving API on future versions.

coudot avatar Apr 25 '24 15:04 coudot