diff --git a/hosts/bicep/services/matrix/smtp-authenticator/smtp_auth_provider.py b/hosts/bicep/services/matrix/smtp-authenticator/smtp_auth_provider.py index a497c9e..6495793 100644 --- a/hosts/bicep/services/matrix/smtp-authenticator/smtp_auth_provider.py +++ b/hosts/bicep/services/matrix/smtp-authenticator/smtp_auth_provider.py @@ -10,6 +10,8 @@ class SMTPAuthProvider: def __init__(self, config: dict, api: module_api): self.api = api + self.config = config + api.register_password_auth_provider_callbacks( auth_checkers={ ("m.login.password", ("password",)): self.check_pass, @@ -26,13 +28,13 @@ class SMTPAuthProvider: return None result = False - with SMTP(config.smtp_host) as smtp: + with SMTP(self.config.smtp_host) as smtp: password = login_dict.get("password") try: smtp.login(username, password) + result = True except: return None - result = True if result == True: return (self.api.get_qualified_user_id(username), None)