Commit f176f5652c60bde2939053910b972ec77842b905

Authored by Antonio Terceiro
1 parent 6193f05c

Revert "Fix user email validation"

This reverts commit 59c15564ebca100f9019d942fcab3c1441a0bc93.

This made a lot of tests fail
app/views/account/_signup_form.html.erb
@@ -135,10 +135,6 @@ @@ -135,10 +135,6 @@
135 135
136 <script type="text/javascript"> 136 <script type="text/javascript">
137 jQuery(function($) { 137 jQuery(function($) {
138 - $.validator.addMethod('validEmail', function(value, element) {  
139 - var regex = /^([^\W_])([\w._-]+)@((?:[-_a-z0-9]+\.)+[a-z]{2,})$/i;  
140 - return this.optional(element) || regex.test(value);  
141 - }, 'Please enter a valid e-mail');  
142 138
143 $('#signup-form input[type=text], #signup-form textarea').each(function() { 139 $('#signup-form input[type=text], #signup-form textarea').each(function() {
144 $(this).bind('blur', function() { 140 $(this).bind('blur', function() {
@@ -174,7 +170,7 @@ jQuery(function($) { @@ -174,7 +170,7 @@ jQuery(function($) {
174 $('#signup-balloon').fadeIn('slow'); 170 $('#signup-balloon').fadeIn('slow');
175 }); 171 });
176 $('#user_login').blur(function() { $('#signup-balloon').fadeOut('slow'); }); 172 $('#user_login').blur(function() { $('#signup-balloon').fadeOut('slow'); });
177 - $('#signup-form').validate({ rules: { 'user[email]': { email: true, validEmail: true } }, messages: { 'user[email]' : '' } }); 173 + $('#signup-form').validate({ rules: { 'user[email]': { email: true } }, messages: { 'user[email]' : '' } });
178 $('#user_email').focus(function() { 174 $('#user_email').focus(function() {
179 $('#email-balloon').fadeIn('slow'); 175 $('#email-balloon').fadeIn('slow');
180 }); 176 });
lib/noosfero/constants.rb
1 module Noosfero::Constants 1 module Noosfero::Constants
2 - EMAIL_FORMAT = /\A([^\W_])([\w._-]+)@((?:[-_a-z0-9]+\.)+[a-z]{2,})\Z/i 2 + EMAIL_FORMAT = /\A([^@\s]+)@((?:[-_a-z0-9]+\.)+[a-z]{2,})\Z/i
3 INTEGER_FORMAT = /\A\d*\Z/i 3 INTEGER_FORMAT = /\A\d*\Z/i
4 PROFILE_PER_PAGE = 10 4 PROFILE_PER_PAGE = 10
5 end 5 end
test/unit/user_test.rb
@@ -14,24 +14,6 @@ class UserTest &lt; ActiveSupport::TestCase @@ -14,24 +14,6 @@ class UserTest &lt; ActiveSupport::TestCase
14 end 14 end
15 end 15 end
16 16
17 - should 'not create user with wrong email' do  
18 - user = User.new(login: 'test_user', email: 'tes*te@hotmail.com',  
19 - password: '123456', password_confirmation: '123456')  
20 - user.save  
21 - assert_equal user.valid?, false  
22 - assert !user.errors[:email].nil?  
23 -  
24 - user.email = '_teste@hotmail.com'  
25 - user.save  
26 - assert_equal user.valid?, false  
27 - assert !user.errors[:email].nil?  
28 -  
29 - user.email = 'teste$@hotmail.com'  
30 - user.save  
31 - assert_equal user.valid?, false  
32 - assert !user.errors[:email].nil?  
33 - end  
34 -  
35 def test_should_require_login 17 def test_should_require_login
36 assert_no_difference 'User.count' do 18 assert_no_difference 'User.count' do
37 u = new_user(:login => nil) 19 u = new_user(:login => nil)