Merge branch 'extend_smtp'
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Eval nix flake / evals (push) Successful in 3m41s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Eval nix flake / evals (push) Successful in 3m41s
				
			This commit is contained in:
		| @@ -5,6 +5,7 @@ from smtplib import SMTP_SSL as SMTP | |||||||
| import synapse | import synapse | ||||||
| from synapse import module_api | from synapse import module_api | ||||||
|  |  | ||||||
|  | import re | ||||||
|  |  | ||||||
| class SMTPAuthProvider: | class SMTPAuthProvider: | ||||||
|     def __init__(self, config: dict, api: module_api): |     def __init__(self, config: dict, api: module_api): | ||||||
| @@ -27,6 +28,10 @@ class SMTPAuthProvider: | |||||||
|         if login_type != "m.login.password": |         if login_type != "m.login.password": | ||||||
|             return None |             return None | ||||||
|  |  | ||||||
|  |         # Convert `@username:server` to `username` | ||||||
|  |         match = re.match(r'^@([\da-z\-\.=_\/\+]+):[\w\d\.:\[\]]+$', username) | ||||||
|  |         username = match.group(1) if match else username | ||||||
|  |  | ||||||
|         result = False |         result = False | ||||||
|         with SMTP(self.config["smtp_host"]) as smtp: |         with SMTP(self.config["smtp_host"]) as smtp: | ||||||
|             password = login_dict.get("password") |             password = login_dict.get("password") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user