Compare commits
	
		
			11 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | b4776b50e2 | ||
|  | 2458b38b75 | ||
|  | 249e28a8b5 | ||
|  | ba9e2d6121 | ||
|  | f042b82a50 | ||
|  | 59071177ad | ||
|  | 6450cd1f20 | ||
|  | 90bc244f3e | ||
|  | 6e52a509db | ||
|  | 5ca666981a | ||
|  | 36f22e5ca6 | 
| @@ -15,7 +15,8 @@ ma1sd - Federated Matrix Identity Server | |||||||
|  |  | ||||||
| --- | --- | ||||||
|  |  | ||||||
| * This project is a fork of the https://github.com/kamax-matrix/mxisd which has been archived and no longer supported. * | * This project is a fork (not successor) of the https://github.com/kamax-matrix/mxisd, which has been archived and no longer maintained as a standalone product. | ||||||
|  | Also, ma1sd is supported by the volunteer not developers of the original project. | ||||||
|  |  | ||||||
| --- | --- | ||||||
|  |  | ||||||
|   | |||||||
| @@ -103,8 +103,8 @@ session: | |||||||
|     validation: |     validation: | ||||||
|       enabled: true |       enabled: true | ||||||
|     unbind: |     unbind: | ||||||
|       notification: |       notifications: true | ||||||
|         enabled: true |       enabled: true | ||||||
|  |  | ||||||
| # DO NOT COPY/PASTE AS-IS IN YOUR CONFIGURATION | # DO NOT COPY/PASTE AS-IS IN YOUR CONFIGURATION | ||||||
| # CONFIGURATION EXAMPLE | # CONFIGURATION EXAMPLE | ||||||
| @@ -115,7 +115,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. Setting `notifications` for `unbind` to false will prevent unbind emails from sending. | ||||||
|  |  | ||||||
| ### Web views | ### Web views | ||||||
| Once a user click on a validation link, it is taken to the Identity Server validation page where the token is submitted.   | Once a user click on a validation link, it is taken to the Identity Server validation page where the token is submitted.   | ||||||
|   | |||||||
| @@ -140,7 +140,7 @@ public class AuthManager { | |||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 try { |                 try { | ||||||
|                     MatrixID.asValid(mxId); |                     MatrixID.asAcceptable(mxId); | ||||||
|                 } catch (IllegalArgumentException e) { |                 } catch (IllegalArgumentException e) { | ||||||
|                     log.warn("The returned User ID {} is not a valid Matrix ID. Login might fail at the Homeserver level", mxId); |                     log.warn("The returned User ID {} is not a valid Matrix ID. Login might fail at the Homeserver level", mxId); | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -48,6 +48,8 @@ public class SessionConfig { | |||||||
|  |  | ||||||
|             private boolean enabled = true; |             private boolean enabled = true; | ||||||
|              |              | ||||||
|  |             private boolean notifications = true; | ||||||
|  |  | ||||||
|             public boolean getEnabled() { |             public boolean getEnabled() { | ||||||
|                 return enabled; |                 return enabled; | ||||||
|             } |             } | ||||||
| @@ -55,11 +57,20 @@ public class SessionConfig { | |||||||
|             public void setEnabled(boolean enabled) { |             public void setEnabled(boolean enabled) { | ||||||
|                 this.enabled = enabled; |                 this.enabled = enabled; | ||||||
|             } |             } | ||||||
|  |              | ||||||
|  |             public boolean shouldNotify() { | ||||||
|  |                 return notifications; | ||||||
|  |             } | ||||||
|  |              | ||||||
|  |             public void setNotifications(boolean notifications) { | ||||||
|  |                 this.notifications = notifications; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public Policy() { |         public Policy() { | ||||||
|             validation.enabled = true; |             validation.enabled = true; | ||||||
|             unbind.enabled = true; |             unbind.enabled = true; | ||||||
|  |             unbind.notifications = true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private PolicyTemplate validation = new PolicyTemplate(); |         private PolicyTemplate validation = new PolicyTemplate(); | ||||||
|   | |||||||
| @@ -57,6 +57,7 @@ import org.slf4j.Logger; | |||||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||||
|  |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
|  | import java.net.URI; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
| import java.util.Base64; | import java.util.Base64; | ||||||
| import java.util.Calendar; | import java.util.Calendar; | ||||||
| @@ -234,7 +235,9 @@ public class SessionManager { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         log.info("Unbinding of {} {} to {} is accepted", tpid.getMedium(), tpid.getAddress(), mxid.getId()); |         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) { |     private void checkAuthorization(String auth, JsonObject reqData) { | ||||||
| @@ -284,7 +287,7 @@ public class SessionManager { | |||||||
|         jsonObject.addProperty("method", "POST"); |         jsonObject.addProperty("method", "POST"); | ||||||
|         jsonObject.addProperty("uri", "/_matrix/identity/api/v1/3pid/unbind"); |         jsonObject.addProperty("uri", "/_matrix/identity/api/v1/3pid/unbind"); | ||||||
|         jsonObject.addProperty("origin", origin); |         jsonObject.addProperty("origin", origin); | ||||||
|         jsonObject.addProperty("destination_is", cfg.getServer().getPublicUrl()); |         jsonObject.addProperty("destination_is", URI.create(cfg.getServer().getPublicUrl()).getHost()); | ||||||
|         jsonObject.add("content", reqData); |         jsonObject.add("content", reqData); | ||||||
|  |  | ||||||
|         String canonical = MatrixJson.encodeCanonical(jsonObject); |         String canonical = MatrixJson.encodeCanonical(jsonObject); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user