Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartc committed Aug 4, 2023
1 parent 4e1f928 commit 75312ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 24 deletions.
14 changes: 4 additions & 10 deletions lib/lightning_web/live/project_live/settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ defmodule LightningWeb.ProjectLive.Settings do

def handle_event("toggle-mfa", _params, socket) do
if can_edit_project(socket.assigns) do
project = toggle_project_mfa(socket)
project = socket.assigns.project

{:ok, project} =
Projects.update_project(project, %{requires_mfa: !project.requires_mfa})

{:noreply,
socket
Expand Down Expand Up @@ -293,13 +296,4 @@ defmodule LightningWeb.ProjectLive.Settings do
{:noreply, assign(socket, :project_changeset, changeset)}
end
end

defp toggle_project_mfa(socket) do
project = socket.assigns.project

{:ok, project} =
Projects.update_project(project, %{requires_mfa: !project.requires_mfa})

project
end
end
12 changes: 2 additions & 10 deletions test/lightning_web/live/profile_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,7 @@ defmodule LightningWeb.ProfileLiveTest do
end

test "user can successfully add MFA to their account", %{conn: conn} do
Application.put_env(
:lightning,
:totp_client,
LightningTest.TOTP
)
Application.put_env(:lightning, :totp_client, LightningTest.TOTP)

{:ok, view, _html} = live(conn, Routes.profile_edit_path(conn, :edit))

Expand Down Expand Up @@ -314,11 +310,7 @@ defmodule LightningWeb.ProfileLiveTest do
end

test "user can successfully setup another device", %{conn: conn} do
Application.put_env(
:lightning,
:totp_client,
LightningTest.TOTP
)
Application.put_env(:lightning, :totp_client, LightningTest.TOTP)

{:ok, view, _html} = live(conn, Routes.profile_edit_path(conn, :edit))

Expand Down
5 changes: 1 addition & 4 deletions test/lightning_web/live/project_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,7 @@ defmodule LightningWeb.ProjectLiveTest do
conn: conn,
user: user
} do
project =
insert(:project,
project_users: [%{user: user, role: :admin}]
)
project = insert(:project, project_users: [%{user: user, role: :admin}])

{:ok, _view, html} =
live(
Expand Down

0 comments on commit 75312ab

Please sign in to comment.