<commit_before>from schema import db, bcrypt
from flask import current_app
from itsdangerous import (TimedJSONWebSignatureSerializer
                          as Serializer)


class User(db.DynamicDocument):
    name = db.StringField(required=True, unique=True)
    group = db.IntField(required=True)
    password_hash = db.StringField(required=True)
    email = db.StringField(required=True, unique=True)

    def hash_password(self, password):
        self.password_hash = bcrypt.generate_password_hash(password).decode('utf-8')

    def check_password(self, password):
        return bcrypt.check_password_hash(self.password_hash, password)

    def generate_auth_token(self):
        s = Serializer(current_app.config.get('SECRET_KEY'),expires_in=99999)
        return s.dumps(str(self.id))<commit_msg>Update db schema of User<commit_after>from flask import current_app
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from schema import db, bcrypt

ROLES = ('student', 'instructor', 'admin')


class User(db.DynamicDocument):
    name = db.StringField(required=True, unique=True)
    role = db.StringField(required=True, choices=ROLES)
    password_hash = db.StringField(required=True)
    email = db.StringField(required=True, unique=True)

    def hash_password(self, password):
        self.password_hash = bcrypt.generate_password_hash(password).decode('utf-8')

    def check_password(self, password):
        return bcrypt.check_password_hash(self.password_hash, password)

    def generate_auth_token(self):
        s = Serializer(current_app.config.get('SECRET_KEY'), expires_in=99999)
        return s.dumps(str(self.id))
{'fraction_non_alphanumeric': 0.1007845503922752, 'fraction_numerical': 0.00724200362100181, 'mean_word_length': 4.582491582491582, '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': '2171089', 'n_tokens_mistral': 508, 'n_tokens_neox': 490, 'n_words': 97}