summaryrefslogtreecommitdiffstats
path: root/bitvend/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitvend/__init__.py')
-rw-r--r--bitvend/__init__.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/bitvend/__init__.py b/bitvend/__init__.py
index 1e9257e..4ffe997 100644
--- a/bitvend/__init__.py
+++ b/bitvend/__init__.py
@@ -2,25 +2,36 @@ import flask
from bitvend.processor import PaymentProcessor
from bitvend.mdb import BitvendCashlessMDBDevice
+from spaceauth import SpaceAuth
dev = BitvendCashlessMDBDevice()
proc = PaymentProcessor(dev)
+spaceauth = SpaceAuth()
from bitvend.utils import to_local_currency, from_local_currency, format_btc, \
sat_to_btc
-from bitvend.models import db, Transaction
-from bitvend.auth import login_manager
+from bitvend.models import db, Transaction, User
import bitvend.views
import bitvend.admin
+@spaceauth.user_loader
+def bitvend_user_loader(username, profile=None):
+ u = User.find(username)
+
+ if not u:
+ u = User(uid=username)
+ db.session.add(u)
+ db.session.commit()
+
+ return u
def create_app():
app = flask.Flask(__name__)
app.config.from_object('bitvend.default_settings')
db.init_app(app)
- login_manager.init_app(app)
+ spaceauth.init_app(app)
dev.init_app(app)
proc.init_app(app)