Skip to content

Commit

Permalink
temporarily display unencrypted email addresses while debugging bounc…
Browse files Browse the repository at this point in the history
…e list #33
  • Loading branch information
nelsonic committed Apr 16, 2020
1 parent 4d00d2c commit 8dc696a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/app/ctx.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,24 @@ defmodule App.Ctx do
def list_sent_with_status do
query = """
SELECT s.id, s.message_id, s.updated_at, s.template,
st.text as status, s.person_id
st.text as status, s.person_id, p.email
FROM sent s
JOIN status as st on s.status_id = st.id
ORDER by s.updated_at DESC
JOIN people as p on s.person_id = p.id
ORDER BY s.updated_at DESC
"""
{:ok, result} = Repo.query(query)

# create List of Maps from the result.rows:
Enum.map(result.rows, fn([id, mid, iat, t, s, pid]) ->
Enum.map(result.rows, fn([id, mid, iat, t, s, pid, e]) ->
%{
id: id,
message_id: mid,
inserted_at: NaiveDateTime.truncate(iat, :second),
template: t,
status: s,
person_id: pid
person_id: pid,
email: Fields.AES.decrypt(e)
}
end)
end
Expand Down
3 changes: 3 additions & 0 deletions lib/app_web/templates/page/dashboard.html.leex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<th>Status</th>
<th>Time</th>
<th>person_id</th>
<th>email</th>

</tr>
</thead>
<tbody>
Expand All @@ -19,6 +21,7 @@
<td class="<%= sent.status %>"><%= sent.status %></td>
<td><%= sent.inserted_at %></td>
<td><%= sent.person_id %></td>
<td><%= sent.email %></td>
</tr>
<% end %>
</tbody>
Expand Down

0 comments on commit 8dc696a

Please sign in to comment.