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):
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)