This commit is contained in:
mwiegand 2021-07-08 17:47:16 +02:00
parent de7b2b91ca
commit 91ab7fc91e
2 changed files with 4 additions and 1 deletions

View file

@ -32,6 +32,9 @@ setup = f"""
ALTER TABLE users
ADD CONSTRAINT no_password_for_redirects
CHECK (redirect IS null OR password IS null);
ALTER TABLE users
ADD CONSTRAINT name_is_not_empty_string
CHECK (name <> '');
-- OWNERSHIPS

View file

@ -2,4 +2,4 @@ hosts = ${host}
dbname = ${name}
user = ${user}
password = ${password}
query = SELECT redirect FROM users LEFT JOIN domains ON users.domain_id = domains.id WHERE redirect IS NOT NULL AND users.name = '%u' AND domains.name = '%d'
query = SELECT redirect FROM users LEFT JOIN domains ON users.domain_id = domains.id WHERE redirect IS NOT NULL AND domains.name = '%d' AND (users.name = '%u' OR users.name IS null)