 
           JAccount.one {"profile.nickname": toBeDeletedUsername}, (err, account)=>
             return callback err  if err?
-            return callback createKodingError "Account not found #{toBeDeletedUsername}"  unless account
+
+            unless account
+              return callback createKodingError \
+                "Account not found #{toBeDeletedUsername}"
 
             # update the account to be deleted with empty data
             account.update $set: accountValues, (err)=>

      guestsGroup.removeMember account, callback

  @convert = secure (client, userFormData, callback) ->
    { connection, sessionToken : clientId, clientIP } = client
    { delegate : account } = connection
    { nickname : oldUsername } = account.profile

        bruteForceControlData =
          ip        : session.clientIP
          username  : username

        # todo add alert support(mail, log etc)
        JLog.checkLoginBruteForce bruteForceControlData, (res)->

          unless res
            return callback createKodingError \
              "Your login access is blocked for #{JLog.timeLimit()} minutes."

          JUser.one { username }, (err, user)->

            if err
              logAndReturnLoginError username, err.message, callback

            # if user not found it means we dont know about given username
            else unless user?
              logAndReturnLoginError username, 'Unknown user name', callback

            # if password is autogenerated return error
            else if user.getAt('passwordStatus') is 'needs reset'
              logAndReturnLoginError username, \
                'You should reset your password in order to continue!', callback

            # hash of given password and given user's salt should match with user's password
            else unless user.getAt('password') is hashPassword password, user.getAt('salt')
              logAndReturnLoginError username, 'Access denied!', callback

            # continue login
            else
              afterLogin user, clientId, session, callback


  @verifyPassword = secure (client, options, callback)->
    {connection: {delegate}} = client
