remove unused vars/aliases and fix bug where first authentication doesn't decrypt link

This commit is contained in:
2022-03-01 22:08:53 -05:00
parent 5047ee653b
commit 45bd5ba81a
8 changed files with 14 additions and 16 deletions

View File

@@ -8,8 +8,6 @@ defmodule EntenduWeb.AuthController do
plug Ueberauth
alias Entendu.UserFromAuth
alias EntenduWeb.LinkView
alias Entendu.EncryptedLink
def delete(conn, _params) do
conn
@@ -27,7 +25,7 @@ defmodule EntenduWeb.AuthController do
def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do
link = get_session(conn, :intended_link)
with %{id: link_id, recipient: recipient} <- link,
with %{id: link_id} <- link,
{:ok, user} <- UserFromAuth.find_or_create(auth) do
# TODO: send over encrypted data that the frontend can decrypt

View File

@@ -9,8 +9,6 @@ defmodule EntenduWeb.LinkController do
alias Entendu.Links
alias Links.Link
alias EntenduWeb.FallbackController
alias Entendu.EncryptedLink
alias Entendu.UserFromAuth
alias EntenduWeb.Plugs.AuthorizeLink
plug AuthorizeLink when action in [:text, :file]
@@ -18,7 +16,8 @@ defmodule EntenduWeb.LinkController do
action_fallback(FallbackController)
def just_page(conn, _params) do
render(conn, "just.html")
conn
|> render("just.html")
end
def just(conn, params) do
@@ -46,7 +45,7 @@ defmodule EntenduWeb.LinkController do
end
def auth_page(conn, %{"id" => link_id}) do
with %Link{id: id, service: service, recipient: recipient} = link <- Links.get_link(link_id) do
with %Link{id: id, service: service, recipient: recipient} <- Links.get_link(link_id) do
conn
|> put_session(:intended_link, %{id: id, service: service, recipient: recipient})
|> render("auth.html", %{intended_link: %{service: service, recipient: recipient}})

View File

@@ -7,7 +7,6 @@ defmodule EntenduWeb.PageController do
def index(conn, _params) do
conn
|> clear_session()
|> render("index.html")
end