New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add regex validation to user email #2389
Conversation
ff92f62
to
3a8a297
Compare
test/unit/user_test.rb
Outdated
assert user.valid? | ||
end | ||
|
||
should "be invalid when it doesn't matche URI mail email regex" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/matche/match/g
What about old invalid values? |
3a8a297
to
e791519
Compare
any tips on how do i run this?
|
Sadly that Ruby regexp uses unsupported feature in PostgreSQL regexp engine. It would be easier to check this in console by |
expected_dom = %(<div class="errorExplanation" id="errorExplanation"><h2>3 errors prohibited this user from being saved</h2><p>There were \ | ||
problems with the following fields:</p><ul><li>Email address is not a valid email</li><li>Email address can't be blank</li><li>Email address is \ | ||
invalid</li></ul></div>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected_dom = %(<div class="errorExplanation" id="errorExplanation"><h2>3 errors prohibited this user from being saved</h2><p>There were \ | |
problems with the following fields:</p><ul><li>Email address is not a valid email</li><li>Email address can't be blank</li><li>Email address is \ | |
invalid</li></ul></div>) | |
expected_dom = <<~HTML.squish.gsub(/>\s+</, "><") | |
<div class="errorExplanation" id="errorExplanation"> | |
<h2>3 errors prohibited this user from being saved</h2> | |
<p>There were problems with the following fields:</p> | |
<ul> | |
<li>Email address is not a valid email</li> | |
<li>Email address can't be blank</li> | |
<li>Email address is invalid</li> | |
</ul> | |
</div> | |
HTML |
I think leaving any invalid email addresses as they are is fine for now. If the user ever updates their details, they will get an error saying their email is invalid. We will need to update some of our scripts (ie: disable user) to skip validation as well. |
remember token gets update during login, so login won't work. simi and I had private discussion about this. Only 16 users have invalid email and only one of them is active, we can handle it though help site. |
e791519
to
5ec3e5b
Compare
Fixes in delayed job to deliver mails: ``` 501 Recipient syntax error /usr/local/lib/ruby/2.5.0/net/smtp.rb:969:in `check_response' /usr/local/lib/ruby/2.5.0/net/smtp.rb:937:in `getok' /usr/local/lib/ruby/2.5.0/net/smtp.rb:865:in `rcptto' /usr/local/lib/ruby/2.5.0/net/smtp.rb:846:in `block in rcptto_list' ```
5ec3e5b
to
bf64d66
Compare
Fixes in delayed job to deliver mails: