bicep/matrix: fix password provider
All checks were successful
Eval nix flake / evals (push) Successful in 2m31s
All checks were successful
Eval nix flake / evals (push) Successful in 2m31s
This commit is contained in:
parent
e4625e8061
commit
eba73ee160
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user