Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
e6ec8ab3
Commit
e6ec8ab3
authored
Mar 20, 2012
by
Felix Schäfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove length limits on some user fields #928
parent
dafe09ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
user.rb
app/models/user.rb
+2
-3
20120320220031_up_user_fields_length_limits.rb
db/migrate/20120320220031_up_user_fields_length_limits.rb
+15
-0
No files found.
app/models/user.rb
View file @
e6ec8ab3
...
@@ -64,10 +64,9 @@ class User < Principal
...
@@ -64,10 +64,9 @@ class User < Principal
validates_uniqueness_of
:mail
,
:if
=>
Proc
.
new
{
|
user
|
!
user
.
mail
.
blank?
},
:case_sensitive
=>
false
validates_uniqueness_of
:mail
,
:if
=>
Proc
.
new
{
|
user
|
!
user
.
mail
.
blank?
},
:case_sensitive
=>
false
# Login must contain lettres, numbers, underscores only
# Login must contain lettres, numbers, underscores only
validates_format_of
:login
,
:with
=>
/^[a-z0-9_\-@\.]*$/i
validates_format_of
:login
,
:with
=>
/^[a-z0-9_\-@\.]*$/i
validates_length_of
:login
,
:maximum
=>
30
validates_length_of
:login
,
:firstname
,
:lastname
,
:maximum
=>
255
validates_length_of
:firstname
,
:lastname
,
:maximum
=>
30
validates_format_of
:mail
,
:with
=>
/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
,
:allow_nil
=>
true
validates_format_of
:mail
,
:with
=>
/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
,
:allow_nil
=>
true
validates_length_of
:mail
,
:maximum
=>
60
,
:allow_nil
=>
true
validates_length_of
:mail
,
:maximum
=>
255
,
:allow_nil
=>
true
validates_confirmation_of
:password
,
:allow_nil
=>
true
validates_confirmation_of
:password
,
:allow_nil
=>
true
validates_inclusion_of
:mail_notification
,
:in
=>
MAIL_NOTIFICATION_OPTIONS
.
collect
(
&
:first
),
:allow_blank
=>
true
validates_inclusion_of
:mail_notification
,
:in
=>
MAIL_NOTIFICATION_OPTIONS
.
collect
(
&
:first
),
:allow_blank
=>
true
validates_inclusion_of
:status
,
:in
=>
[
STATUS_ANONYMOUS
,
STATUS_ACTIVE
,
STATUS_REGISTERED
,
STATUS_LOCKED
]
validates_inclusion_of
:status
,
:in
=>
[
STATUS_ANONYMOUS
,
STATUS_ACTIVE
,
STATUS_REGISTERED
,
STATUS_LOCKED
]
...
...
db/migrate/20120320220031_up_user_fields_length_limits.rb
0 → 100644
View file @
e6ec8ab3
class
UpUserFieldsLengthLimits
<
ActiveRecord
::
Migration
def
self
.
up
change_column
:users
,
:login
,
:string
,
:limit
=>
nil
change_column
:users
,
:mail
,
:string
,
:limit
=>
nil
change_column
:users
,
:firstname
,
:string
,
:limit
=>
nil
change_column
:users
,
:lastname
,
:string
,
:limit
=>
nil
end
def
self
.
down
change_column
:users
,
:login
,
:string
,
:limit
=>
30
change_column
:users
,
:mail
,
:string
,
:limit
=>
60
change_column
:users
,
:firstname
,
:string
,
:limit
=>
30
change_column
:users
,
:lastname
,
:string
,
:limit
=>
30
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment