~homeworkprod/byceps

f00ee41aab243a882f83d4165f2f19b9bbd0f630 — Jochen Kupperschmidt a month ago 8e8caa6
Load email sender for admin app password reset from global settings, hardcode default
2 files changed, 10 insertions(+), 6 deletions(-)

M byceps/blueprints/common/authentication/password/views.py
M byceps/config_defaults.py
M byceps/blueprints/common/authentication/password/views.py => byceps/blueprints/common/authentication/password/views.py +10 -3
@@ 6,7 6,7 @@ byceps.blueprints.common.authentication.password.views
:License: Revised BSD (see `LICENSE` file for details)
"""

from flask import abort, current_app, g, request
from flask import abort, g, request
from flask_babel import gettext

from .....services.authentication.password import (


@@ 18,6 18,7 @@ from .....services.email import (
    service as email_service,
)
from .....services.email.transfer.models import NameAndAddress
from .....services.global_setting import service as global_settings_service
from .....services.user import service as user_service
from .....services.verification_token import (
    service as verification_token_service,


@@ 156,9 157,15 @@ def _get_sender() -> NameAndAddress:
    if g.app_mode.is_site():
        email_config = email_config_service.get_config(g.brand_id)
        return email_config.sender
    elif g.app_mode.is_admin():
        address_str = global_settings_service.find_setting_value(
            'admin_email_sender'
        )
        if not address_str:
            address_str = 'BYCEPS <noreply@byceps.example>'
        return email_service.parse_address(address_str)
    else:
        default_sender = current_app.config['MAIL_DEFAULT_SENDER']
        return email_service.parse_address(default_sender)
        abort(500, 'Unexpected app mode, cannot obtain email sender')


@blueprint.get('/reset/token/<token>')

M byceps/config_defaults.py => byceps/config_defaults.py +0 -3
@@ 53,8 53,5 @@ PATH_DATA = Path('./data')
# Limit incoming request content.
MAX_CONTENT_LENGTH = 4000000

# e-mail
MAIL_DEFAULT_SENDER = 'BYCEPS <noreply@byceps.example>'

# shop
SHOP_ORDER_EXPORT_TIMEZONE = 'Europe/Berlin'