   hash = crypto.createHash 'md5'
   hash.update str
   hash.digest 'hex'
+
+validEmail = (email) ->
+  /^[a-zA-Z0-9+._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test email
+
+escapeURL = require('querystring').escape
 
 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=#{@email}&password=#{@password} to do so.


      Thanks!

    @save fn

  validate: ->
    ['Invalid email address'] unless validEmail @email

  beforeSave: (fn) ->
    @calculateHashes()
