From 6e52a509db1dcf3525eaee423121baa04b29dc65 Mon Sep 17 00:00:00 2001 From: eyecreate Date: Mon, 21 Oct 2019 15:28:30 -0400 Subject: [PATCH 1/4] update session config to allow unbindin emails to not be sent. --- .../java/io/kamax/mxisd/config/SessionConfig.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/io/kamax/mxisd/config/SessionConfig.java b/src/main/java/io/kamax/mxisd/config/SessionConfig.java index a160d90..3c5fb27 100644 --- a/src/main/java/io/kamax/mxisd/config/SessionConfig.java +++ b/src/main/java/io/kamax/mxisd/config/SessionConfig.java @@ -47,6 +47,8 @@ public class SessionConfig { public static class PolicyUnbind { private boolean enabled = true; + + private boolean notifications = true; public boolean getEnabled() { return enabled; @@ -55,11 +57,20 @@ public class SessionConfig { public void setEnabled(boolean enabled) { this.enabled = enabled; } + + public boolean shouldNotify() { + return notifications; + } + + public void setNotifications(boolean notifications) { + this.notifications = notifications; + } } public Policy() { validation.enabled = true; unbind.enabled = true; + unbind.notifications = true; } private PolicyTemplate validation = new PolicyTemplate(); From 90bc244f3e41073acf52202cbfbda51aa97b33e0 Mon Sep 17 00:00:00 2001 From: eyecreate Date: Mon, 21 Oct 2019 15:29:55 -0400 Subject: [PATCH 2/4] update docs to something that works. --- docs/threepids/session/session.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/threepids/session/session.md b/docs/threepids/session/session.md index 022927c..a3f0dc2 100644 --- a/docs/threepids/session/session.md +++ b/docs/threepids/session/session.md @@ -103,8 +103,7 @@ session: validation: enabled: true unbind: - notification: - enabled: true + notifications: true # DO NOT COPY/PASTE AS-IS IN YOUR CONFIGURATION # CONFIGURATION EXAMPLE @@ -115,7 +114,7 @@ are allowed to do in terms of 3PID sessions. The policy has a global on/off swit --- -`unbind` controls warning notifications for 3PID removal. +`unbind` controls warning notifications for 3PID removal. Settings `notifications` for `unbind` to false will prevent unbind emails from sending. ### Web views Once a user click on a validation link, it is taken to the Identity Server validation page where the token is submitted. From 6450cd1f2051cdbedebe204c945eaadf3de20cd6 Mon Sep 17 00:00:00 2001 From: eyecreate Date: Mon, 21 Oct 2019 15:30:46 -0400 Subject: [PATCH 3/4] have session manager check session config for sending notifications on unbinds. --- src/main/java/io/kamax/mxisd/session/SessionManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/kamax/mxisd/session/SessionManager.java b/src/main/java/io/kamax/mxisd/session/SessionManager.java index 004cb58..61fcb66 100644 --- a/src/main/java/io/kamax/mxisd/session/SessionManager.java +++ b/src/main/java/io/kamax/mxisd/session/SessionManager.java @@ -234,7 +234,9 @@ public class SessionManager { } log.info("Unbinding of {} {} to {} is accepted", tpid.getMedium(), tpid.getAddress(), mxid.getId()); - notifMgr.sendForUnbind(tpid); + if (cfg.getSession().getPolicy().getUnbind().shouldNotify()) { + notifMgr.sendForUnbind(tpid); + } } private void checkAuthorization(String auth, JsonObject reqData) { From 59071177ad1233ddcab17fbccda40398816a93db Mon Sep 17 00:00:00 2001 From: eyecreate Date: Mon, 21 Oct 2019 15:33:28 -0400 Subject: [PATCH 4/4] typo --- docs/threepids/session/session.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/threepids/session/session.md b/docs/threepids/session/session.md index a3f0dc2..33154df 100644 --- a/docs/threepids/session/session.md +++ b/docs/threepids/session/session.md @@ -114,7 +114,7 @@ are allowed to do in terms of 3PID sessions. The policy has a global on/off swit --- -`unbind` controls warning notifications for 3PID removal. Settings `notifications` for `unbind` to false will prevent unbind emails from sending. +`unbind` controls warning notifications for 3PID removal. Setting `notifications` for `unbind` to false will prevent unbind emails from sending. ### Web views Once a user click on a validation link, it is taken to the Identity Server validation page where the token is submitted.