Update dependencies

This commit is contained in:
rubenwardy 2020-01-19 02:46:07 +00:00
parent 6e626c0f89
commit 783bc86aaf
6 changed files with 56 additions and 45 deletions

@ -23,7 +23,7 @@ from urllib.parse import urlparse
from flask import Flask, url_for
from flask_sqlalchemy import SQLAlchemy, BaseQuery
from flask_migrate import Migrate
from flask_user import login_required, UserManager, UserMixin, SQLAlchemyAdapter
from flask_user import login_required, UserManager, UserMixin
from sqlalchemy import func, CheckConstraint
from sqlalchemy_searchable import SearchQueryMixin
from sqlalchemy_utils.types import TSVectorType
@ -125,7 +125,7 @@ class User(db.Model, UserMixin):
# User email information
email = db.Column(db.String(255), nullable=True, unique=True)
confirmed_at = db.Column(db.DateTime())
email_confirmed_at = db.Column(db.DateTime())
# User information
profile_pic = db.Column(db.String(255), nullable=True, server_default=None)
@ -148,7 +148,7 @@ class User(db.Model, UserMixin):
def __init__(self, username, active=False, email=None, password=None):
self.username = username
self.confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
self.email_confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
self.display_name = username
self.active = active
self.email = email
@ -1044,5 +1044,4 @@ class ForumTopic(db.Model):
# Setup Flask-User
db_adapter = SQLAlchemyAdapter(db, User) # Register the User model
user_manager = UserManager(db_adapter, app) # Initialize Flask-User
user_manager = UserManager(app, db, User)

@ -102,7 +102,7 @@ def make_flask_user_password(plaintext_str):
else:
return password.decode("UTF-8")
def _do_login_user(user, remember_me=False):
def loginUser(user):
def _call_or_get(v):
if callable(v):
return v()
@ -128,29 +128,14 @@ def _do_login_user(user, remember_me=False):
flash("Your account has not been enabled.", "error")
return False
# Check if user has a confirmed email address
user_manager = current_app.user_manager
if user_manager.enable_email and user_manager.enable_confirm_email \
and not current_app.user_manager.enable_login_without_confirm_email \
and not user.has_confirmed_email():
url = url_for("user.resend_confirm_email")
flash("Your email address has not yet been confirmed", "error")
return False
# Use Flask-Login to sign in user
login_user(user, remember=remember_me)
login_user(user, remember=True)
signals.user_logged_in.send(current_app._get_current_object(), user=user)
flash("You have signed in successfully.", "success")
return True
def loginUser(user):
user_mixin = None
if user_manager.enable_username:
user_mixin = user_manager.find_user_by_username(user.username)
return _do_login_user(user_mixin, True)
def rank_required(rank):
def decorator(f):

@ -1,32 +1,35 @@
USER_APP_NAME="Content DB"
SERVER_NAME="content.minetest.net"
BASE_URL="http://" + SERVER_NAME
USER_APP_NAME = "Content DB"
SERVER_NAME = "content.minetest.net"
BASE_URL = "http://" + SERVER_NAME
SECRET_KEY=""
WTF_CSRF_SECRET_KEY=""
SECRET_KEY = ""
WTF_CSRF_SECRET_KEY = ""
SQLALCHEMY_DATABASE_URI = "sqlite:///../db.sqlite"
GITHUB_CLIENT_ID = ""
GITHUB_CLIENT_SECRET = ""
REDIS_URL='redis://redis:6379'
CELERY_BROKER_URL='redis://redis:6379'
CELERY_RESULT_BACKEND='redis://redis:6379'
REDIS_URL = 'redis://redis:6379'
CELERY_BROKER_URL = 'redis://redis:6379'
CELERY_RESULT_BACKEND = 'redis://redis:6379'
USER_ENABLE_USERNAME = True
USER_ENABLE_REGISTER = False
USER_ENABLE_CHANGE_USERNAME = False
MAIL_USERNAME=""
MAIL_PASSWORD=""
MAIL_DEFAULT_SENDER=""
MAIL_SERVER=""
MAIL_PORT=587
MAIL_USE_TLS=True
MAIL_UTILS_ERROR_SEND_TO=[""]
MAIL_USERNAME = ""
MAIL_PASSWORD = ""
USER_EMAIL_SENDER_NAME = ""
USER_EMAIL_SENDER_EMAIL = ""
MAIL_DEFAULT_SENDER = ""
MAIL_SERVER = ""
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_UTILS_ERROR_SEND_TO = [""]
UPLOAD_DIR="/var/cdb/uploads/"
THUMBNAIL_DIR="/var/cdb/thumbnails/"
UPLOAD_DIR = "/var/cdb/uploads/"
THUMBNAIL_DIR = "/var/cdb/thumbnails/"
LANGUAGES = {
'en': 'English',

@ -0,0 +1,24 @@
"""empty message
Revision ID: 64fee8e5ab34
Revises: 306ce331a2a7
Create Date: 2020-01-19 02:28:05.432244
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '64fee8e5ab34'
down_revision = '306ce331a2a7'
branch_labels = None
depends_on = None
def upgrade():
op.alter_column('user', 'confirmed_at', nullable=False, new_column_name='email_confirmed_at')
def downgrade():
op.alter_column('user', 'email_confirmed_at', nullable=False, new_column_name='confirmed_at')

@ -1,4 +1,4 @@
Flask~=1.0
Flask~=1.1
Flask-FlatPages~=0.7
Flask-Gravatar~=0.5
Flask-Login~=0.4.1
@ -6,18 +6,18 @@ Flask-Markdown~=0.3
Flask-Menu~=0.7
Flask-Migrate~=2.3
Flask-SQLAlchemy~=2.3
Flask-User~=0.6
Flask-User~=1.0
Flask-Babel
GitHub-Flask~=3.2
SQLAlchemy-Searchable==1.0.3
SQLAlchemy-Searchable~=1.1
beautifulsoup4~=4.6
celery~=4.4
kombu~=4.6
GitPython~=2.1
GitPython~=3.0
git-archive-all~=1.20
lxml~=4.2
pillow~=6.2
pillow~=7.0
pyScss~=1.3
redis~=3.3
psycopg2~=2.7

@ -2,4 +2,4 @@
# Run all pending migrations
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db update"
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db upgrade"