<commit_before>var User = require('../models/user'),
		GatewayAccount = require('../models/gateway_account'),
    utils = require('../../lib/utils'),
		util = require('util');

module.exports = (function() {
	function account(req, res) {
    GatewayAccount.find({where: {
      userId: req.params.userId
    }}).complete(function(err, account){
      if (err) {  account = [] }
      res.send(account)
    })
	}

  function create(req, res) {
		req.checkBody('name', 'Invalid name')
			.notEmpty().isAlphanumeric();
		req.checkBody('password', '<PASSWORD>')
			.notEmpty().isAlphanumeric();
		
		var errors = req.validationErrors();
		if (errors) {
			res.send({ error: util.inspect(errors) }, 400)
			return;
		}

    var salt = utils.generateSalt()
    var password = <PASSWORD>
    var passwordHash = utils.saltPassword(password, salt)

    var user = User.createEncrypted(req.body.name, password, function(err, user){
      if (err) { res.send({ error: err }); return }
      res.send({ success: true, user: user })
    })
	}
	
	return {
		account: account,
		create: create
	}
})();
<commit_msg>[CHORE] Clean up gateway users controller from refactor to model<commit_after>var User = require('../models/user'),
		GatewayAccount = require('../models/gateway_account'),
    utils = require('../../lib/utils'),
		util = require('util');

module.exports = (function() {
	function account(req, res) {
    GatewayAccount.find({where: {
      userId: req.params.userId
    }}).complete(function(err, account){
      if (err) {  res.send({ success: false }) }
      res.send({ success: true, gatewayAccount: account[0] })
    })
	}

  function create(req, res) {
		req.checkBody('name', 'Invalid name').notEmpty().isAlphanumeric()
		req.checkBody('password', '<PASSWORD>').notEmpty().isAlphanumeric()
		
		var errors = req.validationErrors();
		if (errors) {
			res.send({ error: util.inspect(errors) }, 400)
			return;
		}

    var user = User.createEncrypted({ name: req.body.name, password: req.body.password }, function(err, user){
      if (err) { res.send({ error: err }); return }
      res.send({ success: true, user: user })
    })
	}
	
	return {
		account: account,
		create: create
	}
})();

{'fraction_non_alphanumeric': 0.17735334242837653, 'fraction_numerical': 0.0031832651205093224, 'mean_word_length': 3.3912175648702596, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800995', 'n_tokens_mistral': 751, 'n_tokens_neox': 705, 'n_words': 156}