       password: hashPassword(newPassword, salt)
     }, callback
 
-  changeEmail:(account, email, callback)->
-
-    @update $set: {email}, (err, res)->
-      if err
-        callback err
-      else
-        account.profile.hash = getHash email
-        account.save (err)-> throw err if err
-        callback null
-
+  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)->

  @changePassword = bongo.secure (client,password,callback)->
    @fetchUser client, (err,user)-> user.changePassword password, callback

  @changeEmail = bongo.secure (client,email,callback)->
    @emailAvailable email, (err, res)=>

      if err

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

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