Project

General

Profile

Actions

Defect #4991

closed

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

Added by Thomas NOEL over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Start date:
2010-03-05
Due date:
% Done:

0%

Estimated time:
1.00 h
Resolution:
Duplicate
Affected version:

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.


Files

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

Related issues

Is duplicate of Redmine - Defect #2719: Increase username length limit from 30 to 60ClosedJean-Philippe Lang2010-09-21

Actions
Actions #1

Updated by Thomas NOEL over 14 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

Actions #2

Updated by Jean-Philippe Lang over 14 years ago

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

See #2719.

Actions

Also available in: Atom PDF