patch.txt

Patch for login names containing umlauts and accent d'aigu - Max Meier, 2011-12-14 11:03

Download (1000 Bytes)

 
1
diff --git a/app/models/user.rb b/app/models/user.rb
2
index c06a907..ba01998 100644
3
--- a/app/models/user.rb
4
+++ b/app/models/user.rb
5
@@ -66,7 +66,12 @@ class User < Principal
6
validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false
7
validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false
8
# Login must contain lettres, numbers, underscores only
9
- validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
10
+ # validates_format_of :login, :with => /^[a-z0-9_\-@\. ]*$/i
11
+
12
+ # Login must contain letters, numbers, underscores, spaces, umlauts only
13
+ # ? ? ? ? ? ? ? ? ?
14
+ # \xDF\xC9\xD6\xDC\xDF\xE4\xE9\xF6\xFC
15
+ validates_format_of :login, :with => /^[a-z0-9_\-@\. \xDF\xC9\xD6\xDC\xDF\xE4\xE9\xF6\xFC]*$/iu
16
validates_length_of :login, :maximum => 30
17
validates_length_of :firstname, :lastname, :maximum => 30
18
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
19