           queue.next()
 
       ->
-        JUser.emit 'UserRegistered', { user, account }
-        queue.next()
-
-      ->
-        # Auto confirm accounts for development environment or Teams ~ GG
-        options = { group : client.context.group, user, email, username }
-        confirmAccountIfNeeded options, (err, pin_) ->
-          return callback err  if err
-          pin = pin_
-          queue.next()
-
-      ->
         date = new Date 0
         subscription =
           accountId          : account.getId()

        queue.next()

      ->
        return queue.next()  if disableCaptcha

        jwtToken = JUser.createJWT { username }

        { status, lastLoginDate } = user
        { createdAt } = account.meta

        sshKeysCount = user.sshKeys.length

        emailFrequency =
          global       : user.emailFrequency.global
          marketing    : user.emailFrequency.marketing

        traits = {
          email
          createdAt
          lastLoginDate
          status

          firstName
          lastName

          subscription
          sshKeysCount
          emailFrequency

          pin
          jwtToken
        }

        Tracker.identify username, traits
        Tracker.alias oldUsername, username

        queue.next()

      ->
        return queue.next()  if disableCaptcha

        subject             = Tracker.types.START_REGISTER
        { username, email } = user

        opts = { pin, email, group: client.context.group, user : { user_id : username, email } }
        Tracker.track username, { to : email, subject }, opts

        queue.next()

      ->
        # don't block register

        queue.next()

      ->
        group = client.context.group
        trackUserOnRegister disableCaptcha, { user, group, pin }

        queue.next()

      ->
        SiftScience = require '../siftscience'
        SiftScience.createAccount client, referrer, ->

    ]

    daisy queue


  identifyUserOnRegister = (disableCaptcha, args) ->

    return  if disableCaptcha

    { user, account, subscription, pin, oldUsername } = args
    { status, lastLoginDate, username, email } = user
    { createdAt, profile } = account.meta
    { firstName, lastName } = account.profile

    jwtToken = JUser.createJWT { username }

    sshKeysCount = user.sshKeys.length

    emailFrequency =
      global       : user.emailFrequency.global
      marketing    : user.emailFrequency.marketing

    traits = {
      email
      createdAt
      lastLoginDate
      status

      firstName
      lastName

      subscription
      sshKeysCount
      emailFrequency

      pin
      jwtToken
    }

    Tracker.identify username, traits
    Tracker.alias oldUsername, username


  trackUserOnRegister = (disableCaptcha, args) ->

    return  if disableCaptcha

    subject              = Tracker.types.START_REGISTER
    { user, group, pin } = args
    { username, email }  = user

    opts = { pin, email, group, user : { user_id : username, email } }
    Tracker.track username, { to : email, subject }, opts


  @createJWT: (data, options = {}) ->
