 
 _.extend Person, {
   login: (credentials, fn) ->
-    @first { email: /^#{credentials.email}$/i }, (error, person) ->
+    return fn ['Invalid email address'] unless validEmail credentials.email
+    @first { email: credentials.email.trim().toLowerCase() }, (error, person) ->
       return fn ['Unknown email'] unless person?
       return fn ['Invalid password'] unless person.passwordHash is md5 credentials.password
       person.token = Math.uuid()

  hash = crypto.createHash 'md5'
  hash.update str
  hash.digest 'hex'

class Team
  constructor: (options, fn) ->

      #{if @password then 'password: ' + @password else 'and whatever password you already set'}

      You still need to complete your registration.
      Please sign in at: http://nodeknockout.com/login?email=#{escapeURL @email}&password=#{@password} to do so.


      Thanks!
