Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Qpixel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Answers
Qpixel
Commits
2e85331d
Commit
2e85331d
authored
Aug 6, 2020
by
ArtOfCode-
Browse files
Options
Downloads
Patches
Plain Diff
Only run email checks if email changed
parent
239a4f3b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/user.rb
+2
-0
2 additions, 0 deletions
app/models/user.rb
with
2 additions
and
0 deletions
app/models/user.rb
+
2
−
0
View file @
2e85331d
...
@@ -125,6 +125,7 @@ class User < ApplicationRecord
...
@@ -125,6 +125,7 @@ class User < ApplicationRecord
def
email_domain_not_blocklisted
def
email_domain_not_blocklisted
return
unless
File
.
exist?
(
Rails
.
root
.
join
(
'../.qpixel-domain-blocklist.txt'
))
return
unless
File
.
exist?
(
Rails
.
root
.
join
(
'../.qpixel-domain-blocklist.txt'
))
return
unless
saved_changes
.
include?
'email'
blocklist
=
File
.
read
(
Rails
.
root
.
join
(
'../.qpixel-domain-blocklist.txt'
)).
split
(
"
\n
"
)
blocklist
=
File
.
read
(
Rails
.
root
.
join
(
'../.qpixel-domain-blocklist.txt'
)).
split
(
"
\n
"
)
email_domain
=
email
.
split
(
'@'
)[
-
1
]
email_domain
=
email
.
split
(
'@'
)[
-
1
]
...
@@ -158,6 +159,7 @@ class User < ApplicationRecord
...
@@ -158,6 +159,7 @@ class User < ApplicationRecord
def
email_not_bad_pattern
def
email_not_bad_pattern
return
unless
File
.
exist?
(
Rails
.
root
.
join
(
'../.qpixel-email-patterns.txt'
))
return
unless
File
.
exist?
(
Rails
.
root
.
join
(
'../.qpixel-email-patterns.txt'
))
return
unless
saved_changes
.
include?
'email'
patterns
=
File
.
read
(
Rails
.
root
.
join
(
'../.qpixel-email-patterns.txt'
)).
split
(
"
\n
"
)
patterns
=
File
.
read
(
Rails
.
root
.
join
(
'../.qpixel-email-patterns.txt'
)).
split
(
"
\n
"
)
matched
=
patterns
.
select
{
|
p
|
email
.
match?
Regexp
.
new
(
p
)
}
matched
=
patterns
.
select
{
|
p
|
email
.
match?
Regexp
.
new
(
p
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment