Module: Authentication

Defined in:
lib/authentication.rb,
lib/authentication/by_password.rb

Defined Under Namespace

Modules: ByPassword, ModelClassMethods, ModelInstanceMethods

Constant Summary collapse

RE_LOGIN_OK =

Uncomment to suit

/\A\w[\w\.\-_@]+\z/
MSG_LOGIN_BAD =

RE_LOGIN_OK = /A[][[:alnum:].-_@]+z/ # Unicode, strict RE_LOGIN_OK = /A[^<>/&]*z/ # Unicode, permissive

"use only letters, numbers, and .-_@ please."
RE_NAME_OK =

Unicode, permissive

/\A[^[:cntrl:]\\<>\/&]*\z/
MSG_NAME_BAD =
"avoid non-printing characters and \\&gt;&lt;&amp;/ please."
RE_EMAIL_NAME =

This is purposefully imperfect – it’s just a check for bogus input. See www.regular-expressions.info/email.html

'[\w\.%\+\-]+'
RE_DOMAIN_HEAD =

RE_EMAIL_NAME = ‘0-9A-Z!#$%&'*+_/=?^-`{|}~.’ # technically allowed by RFC-2822

'(?:[A-Z0-9\-]+\.)+'
RE_DOMAIN_TLD =
'(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)'
RE_EMAIL_OK =
/\A#{RE_EMAIL_NAME}@#{RE_DOMAIN_HEAD}#{RE_DOMAIN_TLD}\z/i
MSG_EMAIL_BAD =
"should look like an email address."
CONSTANTS_DEFINED =

sorry for the C idiom

'yup'

Class Method Summary collapse

Class Method Details

.included(recipient) ⇒ Object



24
25
26
27
28
29
# File 'lib/authentication.rb', line 24

def self.included( recipient )
  recipient.extend( ModelClassMethods )
  recipient.class_eval do
    include ModelInstanceMethods
  end
end