Skip to content
Browse files

Revert login and email regular expressions

  • Loading branch information...
1 parent 05e4524 commit d0e95213da02371e82b1f3ebcc12013fedfb79bb @binarylogic binarylogic committed Nov 12, 2009
View
2 lib/authlogic/regex.rb
@@ -19,7 +19,7 @@ def self.email
# A simple regular expression that only allows for letters, numbers, spaces, and .-_@. Just a standard login / username
# regular expression.
def self.login
- /^\w[\w\.\-_@ ]+$/
+ /\A\w[\w\.+\-_@ ]+$/
end
end
end
View
6 test/acts_as_authentic_test/email_test.rb
@@ -67,15 +67,15 @@ def test_validates_length_of_email_field
def test_validates_format_of_email_field
u = User.new
u.email = "aaaaaaaaaaaaa"
- assert !u.valid?
+ u.valid?
assert u.errors[:email].size > 0
u.email = "a@a.com"
- assert !u.valid?
+ u.valid?
assert u.errors[:email].size == 0
u.email = "dakota.dux+1@gmail.com"
- assert !u.valid?
+ u.valid?
assert u.errors[:email].size == 0
end
View
2 test/acts_as_authentic_test/login_test.rb
@@ -33,7 +33,7 @@ def test_validates_length_of_login_field_options_config
end
def test_validates_format_of_login_field_options_config
- default = {:with => /\A\w[\w\.+\-_@ ]+\z/, :message => I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}
+ default = {:with => /\A\w[\w\.+\-_@ ]+$/, :message => I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}
assert_equal default, User.validates_format_of_login_field_options
assert_equal default, Employee.validates_format_of_login_field_options

0 comments on commit d0e9521

Please sign in to comment.
Something went wrong with that request. Please try again.