                 callback err
               else
                 user.confirmEmail callback
-  
+
   @create =(user, callback)->
     email = user.getAt('email')
     salt = createSalt()

jraphical = require 'jraphical'

module.exports = class JEmailConfirmation extends jraphical.Module
  
  crypto      = require 'crypto'
  createSalt  = require 'hat'
  
  Emailer = require '../emailer'
  
  @share()
  
  @set
    sharedMethods:
      static    : ['confirmByToken']

          'invalid status code'
          ['unconfirmed','confirmed']
        ]

  @confirmByToken = (token, callback)->
    @one {token}, (err, confirmation)->
      if err or !confirmation?
