bicep/matrix: fix password provider
All checks were successful
Eval nix flake / evals (push) Successful in 2m31s

This commit is contained in:
Daniel Lovbrotte Olsen 2023-10-22 01:29:12 +02:00
parent e4625e8061
commit eba73ee160

View File

@ -10,6 +10,8 @@ class SMTPAuthProvider:
def __init__(self, config: dict, api: module_api): def __init__(self, config: dict, api: module_api):
self.api = api self.api = api
self.config = config
api.register_password_auth_provider_callbacks( api.register_password_auth_provider_callbacks(
auth_checkers={ auth_checkers={
("m.login.password", ("password",)): self.check_pass, ("m.login.password", ("password",)): self.check_pass,
@ -26,13 +28,13 @@ class SMTPAuthProvider:
return None return None
result = False result = False
with SMTP(config.smtp_host) as smtp: with SMTP(self.config.smtp_host) as smtp:
password = login_dict.get("password") password = login_dict.get("password")
try: try:
smtp.login(username, password) smtp.login(username, password)
result = True
except: except:
return None return None
result = True
if result == True: if result == True:
return (self.api.get_qualified_user_id(username), None) return (self.api.get_qualified_user_id(username), None)