 
           if createdAt < 20 # min
             if resendIfExists
-              confirmation.sendEmail {subject, firstName}, callback
+              confirmation.sendEmail {subject, firstName, action}, callback
             else
               callback if err then err else new PINExistsError \
                 "PIN exists and not expired,


        # Remove all waiting pins for given action and email
        @remove {username, action}, (err, count)->
          if err then console.warn err
          else
            if count > 0 then console.log "#{count} expired PIN removed."
            else console.log "No such waiting PIN found."

            # Create a random pin
            pin = hat 16

            # Create and send new pin
            confirmation = new JVerificationToken {username, action, email, pin}
            confirmation.save (err)->
              if err
                callback err
              else
                confirmation.sendEmail {subject, firstName}, callback


  @confirmByPin = (options, callback)->

        callback null, false


  getTextBody = ({firstName, pin, action})->

    templates =

      'verify-account': """
        Hi #{firstName},

        Welcome to Koding!

        You can use the following code to verify your koding.com account:

          #{pin}

        Have a nice day!
        --
        Koding Team
      """

      'update-email'  : """
        Hi #{firstName},

        To verify your new e-mail address you can use the following code:

          #{pin}

        Have a nice day!
        --
        Koding Team
      """

      default         : """
        Hi #{firstName},

        Here’s your koding.com verification code:

          #{pin}

        Have a nice day!
        --
        Koding Team
      """

    return templates[action] or templates.default


  sendEmail: ({subject, firstName, action}, callback)->

    JMail = require './email'

