<commit_before>'use strict';

var bcrypt = require('bcrypt');

module.exports = function(sequelize, DataTypes) {
	var User = sequelize.define('User', {
		id: {
			type: DataTypes.INTEGER,
			primaryKey: true,
			autoIncrement: true
		},
		uuid: {
			type: DataTypes.UUID,
			unique: true,
			defaultValue: DataTypes.UUIDV1
		},
		username: {
			type: DataTypes.STRING,
			allowNull: true,
			unique: true
		},
		hashed_password: {
			type: DataTypes.STRING
		},
		name: {
			type: DataTypes.STRING
		},
		email: {
			type: DataTypes.STRING,
			primaryKey: true,
			unique: true,
			validate: {
				isEmail: true
			}
		},
		provider: {
			type: DataTypes.STRING
		},
		roles: {
			type: DataTypes.ARRAY(DataTypes.STRING)
		},
		isActive: {
			type: DataTypes.BOOLEAN
		}
	}, {
		classMethods: {},
		instanceMethods: {
			authenticate: function(plainText) {
				return bcrypt.compare(plainText, this.hashed_password, function(err, res) {
					if (err) {
						throw new Error('Passwords do not match');
					}
					return res;
				});
			},
			getRoles: function() {
				return this.roles;
			},
			addRole: function(role) {
				this.roles.push(role);
				return true;
			},
			removeRole: function(role) {<commit_msg>bug with authenticate<commit_after>'use strict';

var bcrypt = require('bcrypt');

module.exports = function(sequelize, DataTypes) {
	var User = sequelize.define('User', {
		id: {
			type: DataTypes.INTEGER,
			primaryKey: true,
			autoIncrement: true
		},
		uuid: {
			type: DataTypes.UUID,
			unique: true,
			defaultValue: DataTypes.UUIDV1
		},
		username: {
			type: DataTypes.STRING,
			allowNull: true,
			unique: true
		},
		hashed_password: {
			type: DataTypes.STRING
		},
		name: {
			type: DataTypes.STRING
		},
		email: {
			type: DataTypes.STRING,
			primaryKey: true,
			unique: true,
			validate: {
				isEmail: true
			}
		},
		provider: {
			type: DataTypes.STRING
		},
		roles: {
			type: DataTypes.ARRAY(DataTypes.STRING)
		},
		isActive: {
			type: DataTypes.BOOLEAN
		}
	}, {
		classMethods: {},
		instanceMethods: {
			authenticate: function(plainText) {
				bcrypt.compare(plainText, this.hashed_password, function(err, res) {
					if (err) {
						throw new Error('Passwords do not match');
					}
					return res;
				});
			},
			getRoles: function() {
				return this.roles;
			},
			addRole: function(role) {
				this.roles.push(role);
				return true;
			},
			removeRole: function(role) {
{'fraction_non_alphanumeric': 0.1347022587268994, 'fraction_numerical': 0.0008213552361396304, 'mean_word_length': 2.9038461538461537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3475521', 'n_tokens_mistral': 1076, 'n_tokens_neox': 862, 'n_words': 175}