~homeworkprod/byceps

49d49a2edee8b2c864cca10332f764646f6a9019 — Jochen Kupperschmidt 1 year, 2 months ago ef40cc2
Move authentication blueprint into `common` subpackage
19 files changed, 57 insertions(+), 56 deletions(-)

M byceps/application.py
R byceps/blueprints/{authentication/__init__.py => common/authentication/__init__.py}
R byceps/blueprints/{authentication/decorators.py => common/authentication/decorators.py}
R byceps/blueprints/{authentication/forms.py => common/authentication/forms.py}
R byceps/blueprints/{authentication/service.py => common/authentication/service.py}
R byceps/blueprints/{authentication/session.py => common/authentication/session.py}
R byceps/blueprints/{authentication/templates/authentication/login_form.html => common/authentication/templates/common/authentication/login_form.html}
R byceps/blueprints/{authentication/templates/authentication/password_reset_form.html => common/authentication/templates/common/authentication/password_reset_form.html}
R byceps/blueprints/{authentication/templates/authentication/password_update_form.html => common/authentication/templates/common/authentication/password_update_form.html}
R byceps/blueprints/{authentication/templates/authentication/request_password_reset_form.html => common/authentication/templates/common/authentication/request_password_reset_form.html}
R byceps/blueprints/{authentication/views.py => common/authentication/views.py}
M byceps/blueprints/common/user/current/views.py
M byceps/blueprints/core/views.py
M byceps/blueprints/site/consent/views.py
M byceps/blueprints/site/seating/views.py
M byceps/blueprints/site/shop/order/views.py
M byceps/blueprints/site/shop/orders/views.py
M byceps/blueprints/site/ticketing/views.py
M byceps/blueprints/site/user_message/views.py
M byceps/application.py => byceps/application.py +1 -1
@@ 98,7 98,7 @@ def _get_blueprints(app: Flask) -> Iterator[BlueprintReg]:

def _get_blueprints_common() -> Iterator[BlueprintReg]:
    yield from [
        ('authentication',              '/authentication'           ),
        ('common.authentication',       '/authentication'           ),
        ('authorization',               None                        ),
        ('core',                        '/core'                     ),
        ('common.user',                 None                        ),

R byceps/blueprints/authentication/__init__.py => byceps/blueprints/common/authentication/__init__.py +0 -0
R byceps/blueprints/authentication/decorators.py => byceps/blueprints/common/authentication/decorators.py +4 -4
@@ 1,6 1,6 @@
"""
byceps.blueprints.authentication.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.authentication.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 10,8 10,8 @@ from functools import wraps

from flask import g

from ...util.framework.flash import flash_notice
from ...util.views import redirect_to
from ....util.framework.flash import flash_notice
from ....util.views import redirect_to


def login_required(func):

R byceps/blueprints/authentication/forms.py => byceps/blueprints/common/authentication/forms.py +4 -4
@@ 1,6 1,6 @@
"""
byceps.blueprints.authentication.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.authentication.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 10,8 10,8 @@ from flask import g
from wtforms import BooleanField, PasswordField, StringField
from wtforms.validators import InputRequired, EqualTo, Length, ValidationError

from ...services.authentication.password import service as password_service
from ...util.l10n import LocalizedForm
from ....services.authentication.password import service as password_service
from ....util.l10n import LocalizedForm


MINIMUM_PASSWORD_LENGTH = 8

R byceps/blueprints/authentication/service.py => byceps/blueprints/common/authentication/service.py +8 -8
@@ 1,6 1,6 @@
"""
byceps.blueprints.authentication.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.authentication.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 9,13 9,13 @@ byceps.blueprints.authentication.service
from enum import Enum
from typing import Optional, Set

from ...services.authentication.session.models.current_user import CurrentUser
from ...services.authorization import service as authorization_service
from ...services.user import event_service as user_event_service
from ...typing import PartyID, UserID
from ....services.authentication.session.models.current_user import CurrentUser
from ....services.authorization import service as authorization_service
from ....services.user import event_service as user_event_service
from ....typing import PartyID, UserID

from ..admin.core.authorization import AdminPermission
from ..authorization.registry import permission_registry
from ...admin.core.authorization import AdminPermission
from ...authorization.registry import permission_registry

from . import session as user_session


R byceps/blueprints/authentication/session.py => byceps/blueprints/common/authentication/session.py +7 -7
@@ 1,6 1,6 @@
"""
byceps.blueprints.authentication.session
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.authentication.session
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 10,11 10,11 @@ from typing import Optional

from flask import session

from ...services.authentication.exceptions import AuthenticationFailed
from ...services.authentication.session import service as session_service
from ...services.user import service as user_service
from ...services.user.transfer.models import User
from ...typing import PartyID, UserID
from ....services.authentication.exceptions import AuthenticationFailed
from ....services.authentication.session import service as session_service
from ....services.user import service as user_service
from ....services.user.transfer.models import User
from ....typing import PartyID, UserID


KEY_USER_ID = 'user_id'

R byceps/blueprints/authentication/templates/authentication/login_form.html => byceps/blueprints/common/authentication/templates/common/authentication/login_form.html +0 -0
R byceps/blueprints/authentication/templates/authentication/password_reset_form.html => byceps/blueprints/common/authentication/templates/common/authentication/password_reset_form.html +0 -0
R byceps/blueprints/authentication/templates/authentication/password_update_form.html => byceps/blueprints/common/authentication/templates/common/authentication/password_update_form.html +0 -0
R byceps/blueprints/authentication/templates/authentication/request_password_reset_form.html => byceps/blueprints/common/authentication/templates/common/authentication/request_password_reset_form.html +0 -0
R byceps/blueprints/authentication/views.py => byceps/blueprints/common/authentication/views.py +25 -24
@@ 1,6 1,6 @@
"""
byceps.blueprints.authentication.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
byceps.blueprints.common.authentication.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.


@@ 10,30 10,31 @@ from typing import Optional

from flask import abort, g, request, url_for

from ...config import get_app_mode
from ...services.authentication.exceptions import AuthenticationFailed
from ...services.authentication import service as authentication_service
from ...services.authentication.password import service as password_service
from ...services.authentication.password import (
from ....config import get_app_mode
from ....services.authentication.exceptions import AuthenticationFailed
from ....services.authentication import service as authentication_service
from ....services.authentication.password import service as password_service
from ....services.authentication.password import (
    reset_service as password_reset_service,
)
from ...services.authentication.session import service as session_service
from ...services.consent import consent_service
from ...services.email import service as email_service
from ...services.email.transfer.models import Sender
from ...services.site import service as site_service
from ...services.terms import version_service as terms_version_service
from ...services.user import service as user_service
from ...services.verification_token import service as verification_token_service
from ...services.verification_token.models import Token as VerificationToken
from ...typing import UserID
from ...util.framework.blueprint import create_blueprint
from ...util.framework.flash import flash_error, flash_notice, flash_success
from ...util.framework.templating import templated
from ...util.views import redirect_to, respond_no_content

from ..admin.core.authorization import AdminPermission
from ..common.user.creation.views import _find_privacy_policy_consent_subject_id
from ....services.authentication.session import service as session_service
from ....services.consent import consent_service
from ....services.email import service as email_service
from ....services.email.transfer.models import Sender
from ....services.site import service as site_service
from ....services.terms import version_service as terms_version_service
from ....services.user import service as user_service
from ....services.verification_token import service as verification_token_service
from ....services.verification_token.models import Token as VerificationToken
from ....typing import UserID
from ....util.framework.blueprint import create_blueprint
from ....util.framework.flash import flash_error, flash_notice, flash_success
from ....util.framework.templating import templated
from ....util.views import redirect_to, respond_no_content

from ...admin.core.authorization import AdminPermission

from ..user.creation.views import _find_privacy_policy_consent_subject_id

from .forms import (
    LoginForm,

M byceps/blueprints/common/user/current/views.py => byceps/blueprints/common/user/current/views.py +1 -1
@@ 19,7 19,7 @@ from .....util.framework.flash import flash_success
from .....util.framework.templating import templated
from .....util.views import redirect_to

from ....authentication.decorators import login_required
from ...authentication.decorators import login_required

from ..creation.views import _find_newsletter_list_for_brand


M byceps/blueprints/core/views.py => byceps/blueprints/core/views.py +1 -1
@@ 17,7 17,7 @@ from ...services.site import service as site_service
from ...util.framework.blueprint import create_blueprint
from ...util.navigation import Navigation

from ..authentication import service as authentication_blueprint_service
from ..common.authentication import service as authentication_blueprint_service


blueprint = create_blueprint('core', __name__)

M byceps/blueprints/site/consent/views.py => byceps/blueprints/site/consent/views.py +1 -1
@@ 18,7 18,7 @@ from ....util.framework.flash import flash_error, flash_success
from ....util.framework.templating import templated
from ....util.views import redirect_to

from ...authentication.views import _get_required_consent_subject_ids
from ...common.authentication.views import _get_required_consent_subject_ids

from .forms import create_consent_form, get_subject_field_name


M byceps/blueprints/site/seating/views.py => byceps/blueprints/site/seating/views.py +1 -1
@@ 26,7 26,7 @@ from ....util.framework.templating import templated
from ....util.views import respond_no_content

from ...admin.seating.authorization import SeatingPermission
from ...authentication.decorators import login_required
from ...common.authentication.decorators import login_required
from ...authorization.registry import permission_registry

from . import service

M byceps/blueprints/site/shop/order/views.py => byceps/blueprints/site/shop/order/views.py +1 -1
@@ 26,7 26,7 @@ from .....util.framework.flash import flash_error, flash_notice, flash_success
from .....util.framework.templating import templated
from .....util.views import redirect_to

from ....authentication.decorators import login_required
from ....common.authentication.decorators import login_required

from .forms import assemble_articles_order_form, OrderForm


M byceps/blueprints/site/shop/orders/views.py => byceps/blueprints/site/shop/orders/views.py +1 -1
@@ 20,7 20,7 @@ from .....util.framework.flash import flash_error, flash_success
from .....util.framework.templating import templated
from .....util.views import redirect_to

from ....authentication.decorators import login_required
from ....common.authentication.decorators import login_required
from ....site.snippet.templating import render_snippet_as_partial

from .forms import CancelForm

M byceps/blueprints/site/ticketing/views.py => byceps/blueprints/site/ticketing/views.py +1 -1
@@ 22,7 22,7 @@ from ....util.iterables import find
from ....util.framework.templating import templated
from ....util.views import respond_no_content

from ...authentication.decorators import login_required
from ...common.authentication.decorators import login_required

from .forms import SpecifyUserForm
from . import notification_service

M byceps/blueprints/site/user_message/views.py => byceps/blueprints/site/user_message/views.py +1 -1
@@ 17,7 17,7 @@ from ....util.framework.flash import flash_success
from ....util.framework.templating import templated
from ....util.views import redirect_to

from ...authentication.decorators import login_required
from ...common.authentication.decorators import login_required

from .forms import CreateForm