-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Email notifications are not automatically enabled when authenticating via SSO or using inhibit_login
#10882
Comments
inhibit_login
I think this is also true if the client registers with |
The if (
self.hs.config.email_enable_notifs
and self.hs.config.email_notif_for_new_users
):
# Pull the ID of the access token back out of the db
# It would really make more sense for this to be passed
# up when the access token is saved, but that's quite an
# invasive change I'd rather do separately.
if token:
user_tuple = await self.store.get_user_by_access_token(token)
# The token better still exist.
assert user_tuple
token_id = user_tuple.token_id
else:
token_id = None |
I'll try to fix the issue. |
I mistakenly included these changes into a PR for another issue I was working on. Unfortunately, the proposed solution caused the issues mentioned in #11769. See also PR #11770. So, @anoadragon453 @DMRobertson: Do you have any ideas on how to solve this issue? It seems like this might not be a good first issue anymore... |
😲 I guess not. @lukasdenk Thanks for working on this and illuminating some underlying issues, intentional or not! |
You're welcome :) |
Description
Users that authenticate via oidc_provider do not have email notifications enabled by default, even though the server is configured correctly and they have an email address associated with their account.
The problem lies here, where
access_token
is set toNone
inpost_registration_actions()
. This leads to the call to_register_email_threepid()
with a nullaccess_token
, which in turn causes the condition here to evaluate to false, thus preventing the email notification pusher from being added.Steps to reproduce
email.notif_for_new_users: true
andemail.enable_notifs: true
.I expect the email notifications to be enabled upon first login.
Proposed Solution
One solution to this is to include
LoginType.SSO
in theauth_result
object passed to thepost_registration_actions()
function here so that prior to the_register_email_threepid()
call theaccess_token
could be set toTrue
ifauth_result[LoginType.SSO] == True
. (Disclaimer: I have not tried this to verify it is a good solution. The idea came from discussion with @kyrias.)Version information
If not matrix.org:
Version:
"server_version":"1.42.0", "python_version":"3.8.12"
Install method: Docker image
matrixdotorg/synapse:v1.42.0
(Helm chart:https://ananace.gitlab.io/charts/matrix-synapse:2.1.x
)Platform: Kubernetes
The text was updated successfully, but these errors were encountered: