add support for username authentication
This commit is contained in:
@@ -29,7 +29,7 @@ defmodule EntenduWeb.AuthController do
|
||||
|
||||
with %{id: link_id, recipient: recipient} <- link,
|
||||
{:ok, user} <- UserFromAuth.find_or_create(auth),
|
||||
true <- UserFromAuth.can_access?(recipient, user.emails) do
|
||||
true <- UserFromAuth.can_access?(recipient, user) do
|
||||
# TODO: send over encrypted data that the frontend can decrypt
|
||||
|
||||
conn
|
||||
|
@@ -55,7 +55,7 @@ defmodule EntenduWeb.LinkController do
|
||||
def text(conn, %{"id" => link_id}) do
|
||||
with user = get_session(conn, :current_user),
|
||||
%Link{recipient: recipient} = link <- Links.get_link(link_id),
|
||||
true <- UserFromAuth.can_access?(recipient, user.emails) do
|
||||
true <- UserFromAuth.can_access?(recipient, user) do
|
||||
path = EncryptedLink.url({link.text_content, link})
|
||||
send_file(conn, 200, path)
|
||||
end
|
||||
@@ -64,7 +64,7 @@ defmodule EntenduWeb.LinkController do
|
||||
def file(conn, %{"id" => link_id}) do
|
||||
with user = get_session(conn, :current_user),
|
||||
%Link{recipient: recipient} = link <- Links.get_link(link_id),
|
||||
true <- UserFromAuth.can_access?(recipient, user.emails) do
|
||||
true <- UserFromAuth.can_access?(recipient, user) do
|
||||
path = EncryptedLink.url({link.file_content, link})
|
||||
send_file(conn, 200, path)
|
||||
end
|
||||
|
Reference in New Issue
Block a user