diff --git a/invenio_config_tuw/auth/config.py b/invenio_config_tuw/auth/config.py
index de369c8ca8af08751f04e63fe686b6f2d262f3a5..9b6c54f056a398f1f0839b6f1ede4c54b88e4986 100644
--- a/invenio_config_tuw/auth/config.py
+++ b/invenio_config_tuw/auth/config.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020 - 2021 TU Wien.
+# Copyright (C) 2020-2023 TU Wien.
#
# Invenio-Config-TUW is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
@@ -14,6 +14,19 @@ from invenio_oauthclient.contrib.keycloak import KeycloakSettingsHelper
class TUWSSOSettingsHelper(KeycloakSettingsHelper):
"""KeycloakSettingsHelper, adjusted for the needs of TU Data."""
+ def __init__(
+ self, title, description, base_url, realm, app_key=None, icon=None, **kwargs
+ ):
+ """Constructor."""
+ signup_options = kwargs.get("signup_options", None) or {}
+ signup_options.setdefault("send_register_msg", True)
+ signup_options.setdefault("auto_confirm", True)
+ kwargs["signup_options"] = signup_options
+
+ super().__init__(
+ title, description, base_url, realm, app_key=None, icon=None, **kwargs
+ )
+
def get_handlers(self):
return {
"authorized_handler": "invenio_config_tuw.auth:authorized_signup_handler",
diff --git a/invenio_config_tuw/auth/handlers.py b/invenio_config_tuw/auth/handlers.py
index 4ee3e8df8995d07eb54cb6e4776d32a8f51ef61d..b2435b1318a98730a7c6d0041bc0bdaf4339ee65 100644
--- a/invenio_config_tuw/auth/handlers.py
+++ b/invenio_config_tuw/auth/handlers.py
@@ -171,7 +171,10 @@ def base_authorized_signup_handler(resp, remote, *args, **kwargs):
remote_apps = current_app.config["OAUTHCLIENT_REMOTE_APPS"]
precedence_mask = remote_apps[remote.name].get("precedence_mask")
- user = oauth_register(form, account_info["user"], precedence_mask)
+ signup_options = remote_apps[remote.name].get("signup_options")
+ user = oauth_register(
+ form, account_info["user"], precedence_mask, signup_options
+ )
# if registration fails ...
if user is None:
diff --git a/invenio_config_tuw/config.py b/invenio_config_tuw/config.py
index 120419f2f635c3483662b887e5d9ebd168b0e919..3b6f7ea0191344685ae845b86c3b814e0ef22ce4 100644
--- a/invenio_config_tuw/config.py
+++ b/invenio_config_tuw/config.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2021 TU Wien.
+# Copyright (C) 2020-2023 TU Wien.
#
# Invenio-Config-TUW is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
@@ -53,15 +53,26 @@ CONFIG_TUW_DISABLE_ERROR_MAILS = False
MAIL_SERVER = "localhost"
"""Domain ip where mail server is running."""
-SECURITY_EMAIL_SENDER = "no-reply@researchdata.tuwien.ac.at"
+SECURITY_EMAIL_SENDER = "no-reply@tuwien.ac.at"
"""Email address used as sender of account registration emails."""
-SECURITY_EMAIL_SUBJECT_REGISTER = _("Welcome to TU Data!")
-"""Email subject for account registration emails."""
-
MAIL_SUPPRESS_SEND = True
"""Disable email sending by default."""
+SECURITY_SEND_REGISTER_EMAIL = True
+"""Enable sending emails after user registration."""
+
+SECURITY_EMAIL_SUBJECT_REGISTER = _("Welcome to TU Wien Research Data!")
+"""Email subject for account registration emails."""
+
+SECURITY_EMAIL_HTML = True
+"""Send the HTML version of the email."""
+
+# disable sending of emails related to local login
+SECURITY_SEND_PASSWORD_CHANGE_EMAIL = False
+SECURITY_SEND_PASSWORD_RESET_EMAIL = False
+SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL = False
+
# Invenio-Previewer
# =================
diff --git a/invenio_config_tuw/forms.py b/invenio_config_tuw/forms.py
index cfe152073d7f54364673d5929a36d25929fd67f9..b655468d91bdf664ccc92bea971d91cf573b424b 100644
--- a/invenio_config_tuw/forms.py
+++ b/invenio_config_tuw/forms.py
@@ -16,21 +16,6 @@ from wtforms.fields.core import FormField
_security = LocalProxy(lambda: current_app.extensions["security"])
-def calculate_confirmed_at():
- """Calculate the default value of ``confirmed_at``.
-
- If the application is configured in a way that it doesn't send out confirmation
- e-mails (``SECURITY_CONFIRMABLE=False``), then this will give back the
- current UTC time to auto-confirm users' e-mail addresses.
- Otherwise (confirmation is required), it will return ``None`` to mark that the
- e-mail addresses still need confirmation.
- """
- if not current_app.extensions["security"].confirmable:
- return datetime.utcnow()
- else:
- return None
-
-
def tuw_registration_form(*args, **kwargs):
"""Create the registration form for TU Wien.
@@ -71,7 +56,6 @@ def tuw_registration_form(*args, **kwargs):
username = HiddenField()
user_profile = FormField(UserProfileForm, separator=".")
preferences = FormField(UserPreferenceForm, separator=".")
- confirmed_at = None
password = None
recaptcha = None
profile = None # disable the default 'profile' form from invenio
@@ -84,7 +68,6 @@ def tuw_registration_form(*args, **kwargs):
"email": self.email.data,
"username": self.username.data,
"password": None,
- "confirmed_at": calculate_confirmed_at(),
"user_profile": {
"full_name": self.user_profile.full_name.data,
"affiliations": self.user_profile.affiliations.data,