Defect #4991

varchar(30) for login is too short when login=email (ldap typical usage)

Added by Thomas NOEL almost 8 years ago. Updated almost 8 years ago.

Status:ClosedStart date:2010-03-05
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:DatabaseEstimated time:1.00 hour
Target version:-
Resolution:Duplicate Affected version:0.9.3

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.

redmine_login60.patch Magnifier (1.25 KB) Thomas NOEL, 2010-03-05 11:44


Related issues

Duplicates Redmine - Defect #2719: Increase username length limit from 30 to 60 Closed 2010-09-21

History

#1 Updated by Thomas NOEL almost 8 years ago

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 almost 8 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

See #2719.

Also available in: Atom PDF