BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
6 deletions
+10
-6
application_setting.rb
app/models/application_setting.rb
+1
-1
email.rb
app/models/email.rb
+1
-1
member.rb
app/models/member.rb
+1
-2
user.rb
app/models/user.rb
+2
-2
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