From eba73ee1601a3c2f7ad66045114f4c3a8a810f28 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Sun, 22 Oct 2023 01:29:12 +0200 Subject: [PATCH] bicep/matrix: fix password provider --- .../matrix/smtp-authenticator/smtp_auth_provider.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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)