flarum-ext-auth-ldap icon indicating copy to clipboard operation
flarum-ext-auth-ldap copied to clipboard

Make `mail` attribute optional

Open n-peugnet opened this issue 3 years ago • 2 comments

Currently, mail attribute seems to be required. Would it be possible to make it optional and let the user enter an email when creating the account ?

n-peugnet avatar Nov 18 '22 18:11 n-peugnet

I just made a test by not providing the email address in the Controller. The LDAP connection modal asked me to type an Email address that later need to be verified, which is what I would expect in this case.

--- LDAPAuthController.php      2022-11-20 14:11:25.000000000 +0100
+++ "LDAPAuthController copy.php"       2022-11-20 14:11:10.000000000 +0100
@@ -77,7 +77,7 @@
                                                        function (Registration $registration) use ($user, $userLdapUsername, $userLdapMail) {
                                                                $registration
                                                                        ->provide('username', $user[strtolower($userLdapUsername)][0])
-                                                                       ->provideTrustedEmail($user[strtolower($userLdapMail)][0])
+                                                                       // ->provideTrustedEmail($user[strtolower($userLdapMail)][0])
                                                                        //->provideAvatar($user->getJpegPhoto())
                                                                        ->setPayload((array)$user['dn']);
                                                        }

vincent-peugnet avatar Nov 20 '22 13:11 vincent-peugnet

I have little time to test it out myself, could you try the mentioned PR above?

tituspijean avatar Apr 05 '23 22:04 tituspijean