Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
b3635ee4
Commit
b3635ee4
authored
Feb 09, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-add EmailValidator to avoid the repetition of format: { with: Devise.email_regexp }
parent
b34963bc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
6 deletions
+10
-6
app/models/application_setting.rb
app/models/application_setting.rb
+1
-1
app/models/email.rb
app/models/email.rb
+1
-1
app/models/member.rb
app/models/member.rb
+1
-2
app/models/user.rb
app/models/user.rb
+2
-2
app/validators/email_validator.rb
app/validators/email_validator.rb
+5
-0
No files found.
app/models/application_setting.rb
View file @
b3635ee4
...
...
@@ -71,7 +71,7 @@ class ApplicationSetting < ActiveRecord::Base
url:
true
validates
:admin_notification_email
,
format:
{
with:
Devise
.
email_regexp
}
,
email:
true
,
allow_blank:
true
validates
:two_factor_grace_period
,
...
...
app/models/email.rb
View file @
b3635ee4
...
...
@@ -15,7 +15,7 @@ class Email < ActiveRecord::Base
belongs_to
:user
validates
:user_id
,
presence:
true
validates
:email
,
presence:
true
,
uniqueness:
true
,
format:
{
with:
Devise
.
email_regexp
}
validates
:email
,
presence:
true
,
uniqueness:
true
,
email:
true
validate
:unique_email
,
if:
->
(
email
)
{
email
.
email_changed?
}
before_validation
:cleanup_email
...
...
app/models/member.rb
View file @
b3635ee4
...
...
@@ -38,8 +38,7 @@ class Member < ActiveRecord::Base
presence:
{
if: :invite?
},
format:
{
with:
Devise
.
email_regexp
,
email:
{
allow_nil:
true
},
uniqueness:
{
...
...
app/models/user.rb
View file @
b3635ee4
...
...
@@ -146,8 +146,8 @@ class User < ActiveRecord::Base
# Validations
#
validates
:name
,
presence:
true
validates
:notification_email
,
presence:
true
,
format:
{
with:
Devise
.
email_regexp
}
validates
:public_email
,
presence:
true
,
uniqueness:
true
,
format:
{
with:
Devise
.
email_regexp
}
,
allow_blank:
true
validates
:notification_email
,
presence:
true
,
email:
true
validates
:public_email
,
presence:
true
,
uniqueness:
true
,
email:
true
,
allow_blank:
true
validates
:bio
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:username
,
...
...
app/validators/email_validator.rb
0 → 100644
View file @
b3635ee4
class
EmailValidator
<
ActiveModel
::
EachValidator
def
validate_each
(
record
,
attribute
,
value
)
record
.
errors
.
add
(
attribute
,
:invalid
)
unless
value
=~
Devise
.
email_regexp
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