Set up stripe API key on application start
This commit is contained in:
parent
3bcb966efc
commit
84d34e291a
|
@ -5,6 +5,7 @@ from jinja2 import FileSystemLoader, ChoiceLoader
|
|||
import sys
|
||||
import os
|
||||
import locale
|
||||
import stripe
|
||||
|
||||
from fosspay.config import _cfg, _cfgi
|
||||
from fosspay.database import db, init_db
|
||||
|
@ -12,8 +13,6 @@ from fosspay.objects import User
|
|||
from fosspay.common import *
|
||||
from fosspay.network import *
|
||||
|
||||
import fosspay.stripe
|
||||
|
||||
from fosspay.blueprints.html import html
|
||||
|
||||
app = Flask(__name__)
|
||||
|
@ -28,6 +27,8 @@ app.jinja_loader = ChoiceLoader([
|
|||
FileSystemLoader("templates"),
|
||||
])
|
||||
|
||||
stripe.api_key = _cfg("stripe-secret")
|
||||
|
||||
@login_manager.user_loader
|
||||
def load_user(email):
|
||||
return User.query.filter(User.email == email).first()
|
||||
|
|
|
@ -24,6 +24,7 @@ class User(Base):
|
|||
created = Column(DateTime)
|
||||
password_reset = Column(String(128))
|
||||
password_reset_expires = Column(DateTime)
|
||||
stripe_customer = Column(String(256))
|
||||
|
||||
def set_password(self, password):
|
||||
self.password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt()).decode("utf-8")
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
Yeah, it's not pretty. Next steps:
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
Set up a cron job to handle monthly donations. <a href="https://github.com/SirCmpwn/fosspay/wiki/Recurring-donations-cronjob">Relevant documentation</a>.
|
||||
</li>
|
||||
<li>
|
||||
Add some projects. Donors can tell you which project they want to support
|
||||
when they donate.
|
||||
|
@ -22,10 +25,10 @@
|
|||
<code>overrides</code> directory and change it to suit your needs.
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://drewdevault.com/donate?project=fosspay">Donate to fosspay upstream?</a>
|
||||
<a href="https://drewdevault.com/donate?project=fosspay">Donate to fosspay upstream</a>?
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/SirCmpwn/fosspay">Contribute code to fosspay upstream?</a>
|
||||
<a href="https://github.com/SirCmpwn/fosspay">Contribute code to fosspay upstream</a>?
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue