Commit 2926b2cae9fcf48222500ee4f5c65990bb657457

Authored by Antonio Terceiro
1 parent 781d42b4

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 2 AS
3 3 SELECT
4 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 10 as passwd,
7 11 '' as clearpasswd,
8 12 5000 as uid,
... ... @@ -22,21 +26,19 @@ JOIN environments on
22 26 JOIN domains on
23 27 (
24 28 (
25   - profiles.preferred_domain is null and
  29 + profiles.preferred_domain_id is null and
26 30 domains.owner_id = environments.id and
27 31 domains.owner_type = 'Environment'
28 32 )
29 33 OR
30 34 (
31 35 profiles.preferred_domain_id is not null and
32   - domain.owner_id = profiles.id and
  36 + domains.owner_id = profiles.id and
33 37 domains.owner_type = 'Profile'
34 38 )
35 39 )
36 40 WHERE
37   - users.password_type = 'crypt'
38   - AND domains.is_default
39   - AND users.enable_email;
  41 + users.enable_email;
40 42  
41 43 CREATE OR REPLACE VIEW mail_aliases
42 44 AS
... ...