Commit 2926b2cae9fcf48222500ee4f5c65990bb657457
1 parent
781d42b4
Exists in
master
and in
29 other branches
ActionItem1165: support old password types
Showing
1 changed file
with
8 additions
and
6 deletions
Show diff stats
util/mail/postgresql/mail_users.sql
@@ -2,7 +2,11 @@ CREATE OR REPLACE VIEW mail_users | @@ -2,7 +2,11 @@ CREATE OR REPLACE VIEW mail_users | ||
2 | AS | 2 | AS |
3 | SELECT | 3 | SELECT |
4 | users.login || '@' || domains.name as username, | 4 | users.login || '@' || domains.name as username, |
5 | - users.crypted_password as crypted_password, | 5 | + if users.password_type = 'crypt' then |
6 | + users.crypted_password | ||
7 | + else | ||
8 | + '{MD5}' || encode(decode(users.crypted_password,'hex'), 'base64') | ||
9 | + end | ||
6 | as passwd, | 10 | as passwd, |
7 | '' as clearpasswd, | 11 | '' as clearpasswd, |
8 | 5000 as uid, | 12 | 5000 as uid, |
@@ -22,21 +26,19 @@ JOIN environments on | @@ -22,21 +26,19 @@ JOIN environments on | ||
22 | JOIN domains on | 26 | JOIN domains on |
23 | ( | 27 | ( |
24 | ( | 28 | ( |
25 | - profiles.preferred_domain is null and | 29 | + profiles.preferred_domain_id is null and |
26 | domains.owner_id = environments.id and | 30 | domains.owner_id = environments.id and |
27 | domains.owner_type = 'Environment' | 31 | domains.owner_type = 'Environment' |
28 | ) | 32 | ) |
29 | OR | 33 | OR |
30 | ( | 34 | ( |
31 | profiles.preferred_domain_id is not null and | 35 | profiles.preferred_domain_id is not null and |
32 | - domain.owner_id = profiles.id and | 36 | + domains.owner_id = profiles.id and |
33 | domains.owner_type = 'Profile' | 37 | domains.owner_type = 'Profile' |
34 | ) | 38 | ) |
35 | ) | 39 | ) |
36 | WHERE | 40 | WHERE |
37 | - users.password_type = 'crypt' | ||
38 | - AND domains.is_default | ||
39 | - AND users.enable_email; | 41 | + users.enable_email; |
40 | 42 | ||
41 | CREATE OR REPLACE VIEW mail_aliases | 43 | CREATE OR REPLACE VIEW mail_aliases |
42 | AS | 44 | AS |