Implement server_user table
This commit is contained in:
parent
bfb3dccf29
commit
79d5dd5f06
2 changed files with 23 additions and 0 deletions
|
@ -1,5 +1,14 @@
|
||||||
begin transaction;
|
begin transaction;
|
||||||
|
|
||||||
|
create server_user (
|
||||||
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
|
active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||||
|
username TEXT NOT NULL,
|
||||||
|
password TEXT,
|
||||||
|
fullname TEXT,
|
||||||
|
mail TEXT NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
create table newsgroup (
|
create table newsgroup (
|
||||||
id INTEGER PRIMARY KEY NOT NULL,
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|
14
lib/nntp/tiny/user.py
Normal file
14
lib/nntp/tiny/user.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from nntp.tiny.db import DatabaseTable
|
||||||
|
from nntp.tiny.passwd import compare
|
||||||
|
|
||||||
|
class User(DatabaseTable):
|
||||||
|
name = 'server_user'
|
||||||
|
key = 'id'
|
||||||
|
columns = 'id', 'active', 'username', 'password', 'fullname', 'mail',
|
||||||
|
|
||||||
|
def auth(self, password: str):
|
||||||
|
if self.active is False or or self.password is None or self.password == '':
|
||||||
|
return False
|
||||||
|
|
||||||
|
return compare(password, self.password)
|
||||||
|
|
Loading…
Add table
Reference in a new issue