Project

General

Profile

Logins with spaces

Added by Tim De Pauw over 13 years ago

Our Redmine installation allows LDAP logins through Active Directory. However, the user accounts set up there have names containing spaces (they're users' full names), which aren't allowed in Redmine.

I'm not at liberty to alter AD accounts, and adding an LDAP attribute containing a Redmine-compatible username isn't an option. Therefore, I made a minor adjustment to app/models/user.rb: line 59 becomes

validates_format_of :login, :with => /^[A-Za-z][A-Za-z0-9 ]*[a-z0-9]$/

thus, logins start with a letter, end with a lowercase letter or number, and between those two are letters, numbers or spaces. This is sufficient for our particular configuration.

Everything seems to work fine, both with on-the-fly user creation and from scripts/console, but I was wondering if there were any implications I hadn't considered.

Additionally, hacking at Redmine's source code isn't preferred, of course. In fact, I'd already forgotten to reinstate this patch when I upgraded our installation earlier today. Is there any hope of making the regexp configurable?

Thanks.


Replies (3)

RE: Logins with spaces - Added by Felix Schäfer over 13 years ago

Tim De Pauw wrote:

Is there any hope of making the regexp configurable?

It is: the software is open-source and you can change it at will. Other than that: improbable.

RE: Logins with spaces - Added by Tim De Pauw over 13 years ago

Felix Schäfer wrote:

It is: the software is open-source and you can change it at will. Other than that: improbable.

Well yeah, that's kinda why I hacked at it in the first place. :) Just checking if there's a better way.

RE: Logins with spaces - Added by Felix Schäfer over 13 years ago

Maybe in a plugin, but I'm not sure in you can "inactivate" validations when extending a class/model.

    (1-3/3)