kakwa / ldapcherry

Web UI for managing users and groups in multiple directory services.
MIT License
225 stars 70 forks source link

Problem with some emails #66

Open battosai30 opened 3 years ago

battosai30 commented 3 years ago

Hi,

Trying to add a user to my ldap, I met an "Error occured". Looking at stdout, I found that the email wasn't recognize as valid (format was xxxx.yyy-zzz@example.com). I found that the '-' was the problem. Digging into the code I found that __isemail function in /usr/lib/python3.8/site-packages/ldapcherry-1.1.1-py3.8.egg/ldapcherry/attributes.py file was the problem.

So I modified it to :

def _is_email(self, email):                        
      #  pattern = r'[\+\.\w]+@[-\.\w]+\.\w+'          
      #  if re.match(pattern, email):                   
            return True                                      
      #  else:                                           
      #      return False      

Email is not checked at all now but it works, user may be more vigilent now ...

I think the pattern is too basic and this function deserves a better algo ;)

I'm don't know Python at all so I can't do the modification myself :s

Regards