Permalink
Browse files

Merge branch 'master' of github.com:binarylogic/authlogic

  • Loading branch information...
binarylogic committed Jun 1, 2012
2 parents fd433eb + ef7bb3d commit defdfeb2d1351efd68d4ac8180b3109b464ad272
Showing with 10 additions and 9 deletions.
  1. +2 −2 lib/authlogic/acts_as_authentic/email.rb
  2. +1 −1 lib/authlogic/acts_as_authentic/login.rb
  3. +7 −6 lib/authlogic/regex.rb
@@ -65,7 +65,7 @@ def merge_validates_length_of_email_field_options(options = {})
# * <tt>Default:</tt> {:with => Authlogic::Regex.email, :message => lambda {I18n.t('error_messages.email_invalid', :default => "should look like an email address.")}}
# * <tt>Accepts:</tt> Hash of options accepted by validates_format_of
def validates_format_of_email_field_options(value = nil)
- rw_config(:validates_format_of_email_field_options, value, {:with => Authlogic::Regex.email, :message => I18n.t('error_messages.email_invalid', :default => "should look like an email address.")})
+ rw_config(:validates_format_of_email_field_options, value, {:with => Authlogic::Regex.email, :message => lambda {I18n.t('error_messages.email_invalid', :default => "should look like an email address.")}})
end
alias_method :validates_format_of_email_field_options=, :validates_format_of_email_field_options
@@ -107,4 +107,4 @@ def self.included(klass)
end
end
end
-end
+end
@@ -62,7 +62,7 @@ def merge_validates_length_of_login_field_options(options = {})
# * <tt>Default:</tt> {:with => Authlogic::Regex.login, :message => lambda {I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}}
# * <tt>Accepts:</tt> Hash of options accepted by validates_format_of
def validates_format_of_login_field_options(value = nil)
- rw_config(:validates_format_of_login_field_options, value, {:with => Authlogic::Regex.login, :message => I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")})
+ rw_config(:validates_format_of_login_field_options, value, {:with => Authlogic::Regex.login, :message => lambda {I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}})
end
alias_method :validates_format_of_login_field_options=, :validates_format_of_login_field_options
View
@@ -9,17 +9,18 @@ module Regex
# by reading this website: http://www.regular-expressions.info/email.html, which is an excellent resource
# for regular expressions.
def self.email
- return @email_regex if @email_regex
- email_name_regex = '[A-Z0-9_\.%\+\-\']+'
- domain_head_regex = '(?:[A-Z0-9\-]+\.)+'
- domain_tld_regex = '(?:[A-Z]{2,4}|museum|travel)'
- @email_regex = /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
+ @email_regex ||= begin
+ email_name_regex = '[A-Z0-9_\.%\+\-\']+'
+ domain_head_regex = '(?:[A-Z0-9\-]+\.)+'
+ domain_tld_regex = '(?:[A-Z]{2,4}|museum|travel)'
+ /\A#{email_name_regex}@#{domain_head_regex}#{domain_tld_regex}\z/i
+ end
end
# A simple regular expression that only allows for letters, numbers, spaces, and .-_@. Just a standard login / username
# regular expression.
def self.login
- /\A\w[\w\.+\-_@ ]+$/
+ /\A\w[\w\.+\-_@ ]+\z/
end
end
end

0 comments on commit defdfeb

Please sign in to comment.