Skip to content

Commit

Permalink
Revert login and email regular expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Nov 12, 2009
1 parent 05e4524 commit d0e9521
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/authlogic/regex.rb
Expand Up @@ -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
6 changes: 3 additions & 3 deletions test/acts_as_authentic_test/email_test.rb
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/acts_as_authentic_test/login_test.rb
Expand Up @@ -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

Expand Down

0 comments on commit d0e9521

Please sign in to comment.