2024-11-15 15:07:29 +00:00
|
|
|
from flask import Blueprint, redirect, request, url_for
|
|
|
|
from flask_login import current_user
|
|
|
|
from app import db
|
2019-07-04 13:17:51 +00:00
|
|
|
|
|
|
|
|
2021-09-13 09:45:43 +00:00
|
|
|
bp = Blueprint('auth', __name__)
|
2024-11-15 15:07:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
@bp.before_app_request
|
|
|
|
def before_request():
|
|
|
|
if not current_user.is_authenticated:
|
|
|
|
return
|
|
|
|
|
|
|
|
current_user.ping()
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
if (
|
|
|
|
not current_user.confirmed
|
|
|
|
and request.endpoint
|
|
|
|
and request.blueprint != 'auth'
|
|
|
|
and request.endpoint != 'static'
|
|
|
|
):
|
|
|
|
return redirect(url_for('auth.unconfirmed'))
|
|
|
|
|
|
|
|
if not current_user.terms_of_use_accepted:
|
|
|
|
return redirect(url_for('main.terms_of_use'))
|
|
|
|
|
|
|
|
|
2021-09-13 09:45:43 +00:00
|
|
|
from . import routes
|