claudehohl / Stikked

An advanced and beautiful pastebin written in PHP
990 stars 219 forks source link

LDAP username with punctuation is not allowed #101

Closed jonnsn closed 9 years ago

jonnsn commented 11 years ago

Hi,

LDAP Usernames currently may only contain alpha-numeric characters, underscores, and dashes. In my experience they are often build like this:

. So I propose to change the Validation Rul in Auth::login to something that allows that scheme. Regards
lightswitch05 commented 10 years ago

The actual LDAP authentication (and resulting form validation) is handled by a 3rd party library Auth LDAP. I would like to keep our copy of the library in sync with the version hosted by @gwojtak - I suggest you either make the change in your own version auth.php - line 48, or someone submit a pull request to fix the problem in Auth LDAP

claudehohl commented 10 years ago

Good idea. Thanks for the tipp!

claudehohl commented 10 years ago

Ok. According to the CI docs, custom form validation rules are possible: http://ellislab.com/codeigniter%20/user-guide/libraries/form_validation.html#callbacks

Implemented: https://github.com/claudehohl/Stikked/commit/5678e09c4402fb688668fd09e2066f198eca8432 (sorry for the big changes, my codeformatter in action... the corresponding line is now nr. 69)

Since I haven't setup an LDAP-server - can somebody test this?

kjacobsen commented 10 years ago

Hi Guys,

Just spent a few hours working on issues with LDAP Auth.

Turns out the changes of the line from

 $rules->set_rules('username', 'Username', 'required|alpha_dash');, 

to

$rules->set_rules('username', 'Username', 'required|callback_alpha_dash_dot'); 

completely breaks LDAP auth. switched that line back on my install, and its all working again.

Any ideas?