   @changePassword = bongo.secure (client,password,callback)->
     @fetchUser client, (err,user)-> user.changePassword password, callback
 
-  @changeEmail = bongo.secure (client,email,callback)->
+  @changeEmail = bongo.secure (client, options, callback)->
+
+    {email} = options
+
     @emailAvailable email, (err, res)=>
 
       if err

      else
        @fetchUser client, (err,user)->
          account = client.connection.delegate
          user.changeEmail account, email, callback

  @emailAvailable = (email, callback)->
    @count {email}, (err, count)->

      password: hashPassword(newPassword, salt)
    }, callback

  changeEmail:(account, options, callback)->

    {email, pin} = options

    if not pin
      options =
        action    : "update-email"
        user      : @
        email     : email

      JVerify.requestNewPin options, callback

    else
      options =
        action    : "update-email"
        username  : @getAt 'username'
        email     : email
        pin       : pin

      JVerify.confirmByPin options, (err, confirmed)=>

        if err then callback err
        else if confirmed
          @update $set: {email}, (err, res)=>
            if err
              callback err
            else
              account.profile.hash = getHash email
              account.save (err)-> throw err if err
              callback null
        else
          callback new KodingError 'PIN is not confirmed.'

  sendEmailConfirmation:(callback=->)->
    JEmailConfirmation.create @, (err, confirmation)->
