Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE FUNCTION passdb_lookup(TEXT)
- RETURNS TABLE("user" TEXT, "password" TEXT)
- LANGUAGE sql
- AS $$
- SELECT
- name, password_digest
- FROM mailboxes
- WHERE (NOT is_alias) AND (active)
- AND ((lower($1) = name) OR (lower($1) = login))
- UNION
- SELECT
- lower($1), password_digest
- FROM mailboxes
- WHERE (active) AND id IN (
- SELECT
- parent_id
- FROM mailboxes
- WHERE (active) AND (is_login_alias)
- AND (lower($1) = name)
- )
- $$;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement