           callback null
 
   @changePassword = secure (client, password, callback) ->
+
     @fetchUser client, (err,user)->
-      return callback createKodingError "Something went wrong please try again!" if err or not user
+
+      if err or not user
+        return callback createKodingError \
+          "Something went wrong please try again!"
+
       if user.getAt('password') is hashPassword password, user.getAt('salt')
         return callback createKodingError "PasswordIsSame"
 

        callback null
      return

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

      JVerificationToken.requestNewPin options, callback

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

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



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


  @usernameAvailable = (username, callback)->
    JName = require '../name'

    username += ''
    res =
      kodingUser : no
      forbidden  : yes

    JName.count { name: username }, (err, count)=>

      if err or username.length < 4 or username.length > 25
        callback err, res
      else
        res.kodingUser = count is 1
        res.forbidden  = username in @bannedUserList
        callback null, res


