File size: 553 Bytes
2b80df9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from db_utils import Base
from sqlalchemy import Column, String
from passlib.context import CryptContext

pwd_cxt = CryptContext(schemes=['bcrypt'], deprecated="auto")

class Hash():
    def bcrypt(password: str):
        return pwd_cxt.hash(password)

    def verify(plain_password: str, hashed_password: str):
        return pwd_cxt.verify(plain_password, hashed_password)

class DBUsers(Base):
    __tablename__ = 'users'
    id = Column(String, primary_key=True)
    username = Column(String)
    password = Column(String)
    email = Column(String)