Defect #4991
varchar(30) for login is too short when login=email (ldap typical usage)
| Status: | Closed | Start date: | 2010-03-05 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | Database | |||
| Target version: | - | Estimated time: | 1.00 hour | |
| Affected version: | 0.9.3 | Resolution: | Duplicate |
Description
Hi there,
I use redmine with a LDAP authentification. The login is the email address (very classic). But I have some users with long email addresses, that exceed 30 chars. They cannot use my system...
I see that in ./app/models/user.rb :
validates_length_of :login, :maximum => 30
I think it would be better to put the same lenght as mail : 60.
Thanks.
Related issues
History
#1 Updated by Thomas NOEL about 2 years ago
- File redmine_login60.patch added
A solution (and it works...) :
diff -urN redmine.orig/app/models/user.rb redmine/app/models/user.rb
--- redmine.orig/app/models/user.rb 2010-03-05 10:40:26.000000000 +0000
+++ redmine/app/models/user.rb 2010-03-05 10:24:02.000000000 +0000
@@ -57,7 +57,7 @@
validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false
# Login must contain lettres, numbers, underscores only
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
- validates_length_of :login, :maximum => 30
+ validates_length_of :login, :maximum => 60
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i
validates_length_of :firstname, :lastname, :maximum => 30
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
diff -urN redmine.orig/db/migrate/20100305102409_login60.rb redmine/db/migrate/20100305102409_login60.rb
--- redmine.orig/db/migrate/20100305102409_login60.rb 1970-01-01 00:00:00.000000000 +0000
+++ redmine/db/migrate/20100305102409_login60.rb 2010-03-05 10:31:21.000000000 +0000
@@ -0,0 +1,9 @@
+class Login60 < ActiveRecord::Migration
+ def self.up
+ change_column :users, :login, :string, :limit => 60
+ end
+
+ def self.down
+ change_column :users, :login, :string, :limit => 30
+ end
+end
#2 Updated by Jean-Philippe Lang about 2 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
See #2719.
