forked from ticketfrei/ticketfrei
Merge branch 'multi-deployment' of dl6tom.de:public/ticketfrei into multi-deployment
This commit is contained in:
commit
788f55860b
8
db.py
8
db.py
|
@ -4,7 +4,6 @@ import logging
|
||||||
from os import urandom
|
from os import urandom
|
||||||
from pylibscrypt import scrypt_mcf
|
from pylibscrypt import scrypt_mcf
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from user import User
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -96,6 +95,8 @@ class DB(object):
|
||||||
twitter_accounts_id INTEGER,
|
twitter_accounts_id INTEGER,
|
||||||
tweet_id TEXT,
|
tweet_id TEXT,
|
||||||
FOREIGN KEY(user_id) REFERENCES user(id)
|
FOREIGN KEY(user_id) REFERENCES user(id)
|
||||||
|
FOREIGN KEY(twitter_accounts_id)
|
||||||
|
REFERENCES twitter_accounts(id)
|
||||||
);
|
);
|
||||||
CREATE TABLE IF NOT EXISTS mailinglist (
|
CREATE TABLE IF NOT EXISTS mailinglist (
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
|
||||||
|
@ -103,8 +104,6 @@ class DB(object):
|
||||||
email TEXT,
|
email TEXT,
|
||||||
active INTEGER,
|
active INTEGER,
|
||||||
FOREIGN KEY(user_id) REFERENCES user(id)
|
FOREIGN KEY(user_id) REFERENCES user(id)
|
||||||
FOREIGN KEY(twitter_accounts_id)
|
|
||||||
REFERENCES twitter_accounts(id)
|
|
||||||
);
|
);
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
@ -117,6 +116,7 @@ class DB(object):
|
||||||
}, self.secret).decode('ascii')
|
}, self.secret).decode('ascii')
|
||||||
|
|
||||||
def confirm(self, token):
|
def confirm(self, token):
|
||||||
|
from user import User
|
||||||
try:
|
try:
|
||||||
json = jwt.decode(token, self.secret)
|
json = jwt.decode(token, self.secret)
|
||||||
except jwt.DecodeError:
|
except jwt.DecodeError:
|
||||||
|
@ -134,6 +134,7 @@ class DB(object):
|
||||||
return User(uid)
|
return User(uid)
|
||||||
|
|
||||||
def by_email(self, email):
|
def by_email(self, email):
|
||||||
|
from user import User
|
||||||
self.execute("SELECT user_id FROM email WHERE email=?;", (email, ))
|
self.execute("SELECT user_id FROM email WHERE email=?;", (email, ))
|
||||||
try:
|
try:
|
||||||
uid, = self.cur.fetchone()
|
uid, = self.cur.fetchone()
|
||||||
|
@ -143,6 +144,7 @@ class DB(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def active_users(self):
|
def active_users(self):
|
||||||
|
from user import User
|
||||||
self.execute("SELECT id FROM user WHERE enabled=1;")
|
self.execute("SELECT id FROM user WHERE enabled=1;")
|
||||||
return [User(uid) for uid, in self.cur.fetchall()]
|
return [User(uid) for uid, in self.cur.fetchall()]
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
import bottle
|
import bottle
|
||||||
from bottle import get, post, redirect, request, response, view
|
from bottle import get, post, redirect, request, response, view
|
||||||
from config import config
|
from config import config
|
||||||
|
|
Loading…
Reference in a new issue