     @save fn
 
   validate: ->
-    ['Invalid email address'] unless /^[a-zA-Z0-9+._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test @email
+    ['Invalid email address'] unless validEmail @email
 
   beforeSave: (fn) ->
     @calculateHashes()


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

      #{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!
