mirror of
https://github.com/Cian-H/invenio-config-iform.git
synced 2025-12-22 21:11:57 +00:00
feature: override email welcome template
* overrides flask-security welcome template
This commit is contained in:
@@ -34,15 +34,18 @@ recursive-include docs *.py
|
|||||||
recursive-include docs *.rst
|
recursive-include docs *.rst
|
||||||
recursive-include docs *.txt
|
recursive-include docs *.txt
|
||||||
recursive-include docs Makefile
|
recursive-include docs Makefile
|
||||||
recursive-include invenio_config_tugraz *.html
|
|
||||||
recursive-include tests *.py
|
recursive-include tests *.py
|
||||||
|
|
||||||
|
|
||||||
# added by check_manifest.py
|
# added by check_manifest.py
|
||||||
recursive-include invenio_config_tugraz *.crt
|
recursive-include invenio_config_tugraz *.crt
|
||||||
recursive-include invenio_config_tugraz *.json
|
recursive-include invenio_config_tugraz *.json
|
||||||
recursive-include invenio_config_tugraz *.key
|
recursive-include invenio_config_tugraz *.key
|
||||||
recursive-include invenio_config_tugraz *.xml
|
recursive-include invenio_config_tugraz *.xml
|
||||||
recursive-include invenio_config_tugraz *.gitkeep
|
recursive-include invenio_config_tugraz *.gitkeep
|
||||||
|
recursive-include invenio_config_tugraz *.txt
|
||||||
|
recursive-include invenio_config_tugraz *.html
|
||||||
|
|
||||||
|
|
||||||
# added by check-manifest
|
# added by check-manifest
|
||||||
recursive-include invenio_config_tugraz *.csv
|
recursive-include invenio_config_tugraz *.csv
|
||||||
|
|||||||
@@ -172,6 +172,15 @@ SECURITY_CONFIRMABLE = False
|
|||||||
Instead user will get a welcome email.
|
Instead user will get a welcome email.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Flask-Security
|
||||||
|
# =============
|
||||||
|
# See https://pythonhosted.org/Flask-Security/configuration.html
|
||||||
|
SECURITY_EMAIL_PLAINTEXT = True
|
||||||
|
"""Render email content as plaintext."""
|
||||||
|
|
||||||
|
SECURITY_EMAIL_HTML = False
|
||||||
|
"""Render email content as HTML."""
|
||||||
|
|
||||||
|
|
||||||
ACCOUNTS = True
|
ACCOUNTS = True
|
||||||
"""Tells if the templates should use the accounts module.
|
"""Tells if the templates should use the accounts module.
|
||||||
@@ -208,9 +217,7 @@ RECAPTCHA_PRIVATE_KEY = None
|
|||||||
# See:
|
# See:
|
||||||
# https://invenio-rdm-records.readthedocs.io/en/latest/configuration.html
|
# https://invenio-rdm-records.readthedocs.io/en/latest/configuration.html
|
||||||
#
|
#
|
||||||
RDM_RECORDS_USER_FIXTURE_PASSWORDS = {
|
RDM_RECORDS_USER_FIXTURE_PASSWORDS = {"info@tugraz.at": None}
|
||||||
"info@tugraz.at": None
|
|
||||||
}
|
|
||||||
"""Overrides for the user fixtures' passwords.
|
"""Overrides for the user fixtures' passwords.
|
||||||
The password set for a user fixture in this dictionary overrides the
|
The password set for a user fixture in this dictionary overrides the
|
||||||
password set in the ``users.yaml`` file. This can be used to set custom
|
password set in the ``users.yaml`` file. This can be used to set custom
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
# details.
|
# details.
|
||||||
|
|
||||||
"""invenio module that adds tugraz configs."""
|
"""invenio module that adds tugraz configs."""
|
||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
from . import config
|
from . import config
|
||||||
|
|
||||||
|
|||||||
26
invenio_config_tugraz/templates/security/email/welcome.html
Normal file
26
invenio_config_tugraz/templates/security/email/welcome.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<p>
|
||||||
|
{% trans salut=current_userprofile.full_name or user.email %}
|
||||||
|
Dear {{ salut }}!
|
||||||
|
{% endtrans %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ _('To help you get started, here are some useful links:') }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.index') }}"> {{ _('TU Graz Repository') }} </a> <br>
|
||||||
|
<a href="{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.guide')">{{ _('Reference Guide') }}</a><br>
|
||||||
|
<a href="{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.terms')"> {{ _('Terms and Conditions') }} </a> <br>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if security.confirmable %}
|
||||||
|
<p>{{ _('You can confirm your email through the link below:') }}</p>
|
||||||
|
|
||||||
|
<p><a href="{{ confirmation_link }}">{{ _('Confirm my account') }}</a></p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ _('Best regards') }} <br>
|
||||||
|
{{ _('TU Graz Repository Team') }}
|
||||||
|
</p>
|
||||||
14
invenio_config_tugraz/templates/security/email/welcome.txt
Normal file
14
invenio_config_tugraz/templates/security/email/welcome.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{{ _('Dear %(email)s!', email=user.email) }}
|
||||||
|
{{ _('To help you get started, here are some useful links:') }}
|
||||||
|
|
||||||
|
{{ _('Repository')}}: https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.index') }}
|
||||||
|
{{ _('Repository Guide')}}: https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.guide') }}
|
||||||
|
{{ _('Terms And Conditions')}}: https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.terms') }}
|
||||||
|
|
||||||
|
{% if security.confirmable %}
|
||||||
|
{{ _('You can confirm your email through the link below:') }}
|
||||||
|
{{ confirmation_link }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ _('Best regards') }}
|
||||||
|
{{ _('TU Graz Repository Team') }}
|
||||||
44
invenio_config_tugraz/views.py
Normal file
44
invenio_config_tugraz/views.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020-2021 Graz University of Technology.
|
||||||
|
#
|
||||||
|
# invenio-config-tugraz is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the MIT License; see LICENSE file for more
|
||||||
|
# details.
|
||||||
|
|
||||||
|
"""invenio module for TUGRAZ config."""
|
||||||
|
|
||||||
|
from os import environ
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
from elasticsearch_dsl.utils import AttrDict
|
||||||
|
from flask import Blueprint, current_app
|
||||||
|
|
||||||
|
|
||||||
|
def ui_blueprint(app):
|
||||||
|
"""Blueprint for the routes and resources provided by invenio-config-tugraz."""
|
||||||
|
blueprint = Blueprint(
|
||||||
|
"invenio_config_tugraz",
|
||||||
|
__name__,
|
||||||
|
template_folder="templates",
|
||||||
|
)
|
||||||
|
|
||||||
|
@blueprint.before_app_first_request
|
||||||
|
def rank_higher():
|
||||||
|
"""Rank this modules blueprint higher than blueprint of security module."""
|
||||||
|
blueprints = current_app._blueprint_order
|
||||||
|
our_index = None
|
||||||
|
security_index = None
|
||||||
|
|
||||||
|
for index, bp in enumerate(blueprints):
|
||||||
|
if bp.name == "security":
|
||||||
|
security_index = index
|
||||||
|
if bp.name == "invenio_config_tugraz":
|
||||||
|
our_index = index
|
||||||
|
|
||||||
|
if (security_index is not None) and (our_index > security_index):
|
||||||
|
temp = blueprints[security_index]
|
||||||
|
blueprints[security_index] = blueprints[our_index]
|
||||||
|
blueprints[our_index] = temp
|
||||||
|
|
||||||
|
return blueprint
|
||||||
3
setup.py
3
setup.py
@@ -84,6 +84,9 @@ setup(
|
|||||||
"invenio_base.apps": [
|
"invenio_base.apps": [
|
||||||
"invenio_config_tugraz = invenio_config_tugraz:InvenioConfigTugraz",
|
"invenio_config_tugraz = invenio_config_tugraz:InvenioConfigTugraz",
|
||||||
],
|
],
|
||||||
|
"invenio_base.blueprints": [
|
||||||
|
"invenio_config_tugraz = invenio_config_tugraz.views:ui_blueprint",
|
||||||
|
],
|
||||||
"invenio_i18n.translations": [
|
"invenio_i18n.translations": [
|
||||||
"messages = invenio_config_tugraz",
|
"messages = invenio_config_tugraz",
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user