diff --git a/.tool-versions b/.tool-versions index 78588a5d9..4bc29d370 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ nodejs 16.6.2 -elixir 1.12.2-otp-24 -erlang 24.0.5 +elixir 1.12.3-otp-24 +erlang 24.0.6 ruby 2.7.4 diff --git a/apps/fz_http/lib/fz_http_web/controllers/rule_controller.ex b/apps/fz_http/lib/fz_http_web/controllers/rule_controller.ex index 3b9dd202e..e7a3d150d 100644 --- a/apps/fz_http/lib/fz_http_web/controllers/rule_controller.ex +++ b/apps/fz_http/lib/fz_http_web/controllers/rule_controller.ex @@ -7,6 +7,6 @@ defmodule FzHttpWeb.RuleController do plug :redirect_unauthenticated def index(conn, _params) do - render(conn, "index.html", page_heading: "Rules") + render(conn, "index.html", page_title: "Rules") end end diff --git a/apps/fz_http/lib/fz_http_web/live/account_live/form_component.html.heex b/apps/fz_http/lib/fz_http_web/live/account_live/form_component.html.heex new file mode 100644 index 000000000..550197f2f --- /dev/null +++ b/apps/fz_http/lib/fz_http_web/live/account_live/form_component.html.heex @@ -0,0 +1,64 @@ +
+ <.form let={f} for={@changeset} id="account-edit" phx-target={@myself} phx-submit="save"> +
+

Change email or enter new password below.

+
+ +
+ <%= label f, :email, class: "label" %> + +
+ <%= text_input f, :email, class: "input" %> +
+

+ <%= error_tag f, :email %> +

+
+ +
+ <%= label f, :password, "New password", class: "label" %> +
+ <%= password_input f, :password, class: "input password" %> +
+

+ <%= error_tag f, :password %> +

+
+ +
+ <%= label f, :password_confirmation, "New password confirmation", class: "label" %> +
+ <%= password_input f, :password_confirmation, class: "input password" %> +
+

+ <%= error_tag f, :password_confirmation %> +

+
+ +
+ +
+

Enter your current password to make these changes.

+
+ +
+ <%= label f, :current_password, class: "label" %> + <%= password_input f, :current_password, class: "input password" %> + +

+ <%= error_tag f, :current_password %> +

+
+ +
+
+
+
+
+ <%= submit "Save", phx_disable_with: "Saving...", class: "button is-primary" %> +
+
+
+
+ +
diff --git a/apps/fz_http/lib/fz_http_web/live/account_live/form_component.html.leex b/apps/fz_http/lib/fz_http_web/live/account_live/form_component.html.leex deleted file mode 100644 index 2c9a1e6ca..000000000 --- a/apps/fz_http/lib/fz_http_web/live/account_live/form_component.html.leex +++ /dev/null @@ -1,62 +0,0 @@ -<%= f = form_for @changeset, "#", [id: "account-edit", phx_target: @myself, phx_submit: "save"] %> -
-

Change email or enter new password below.

-
- -
- <%= label f, :email, class: "label" %> - -
- <%= text_input f, :email, class: "input" %> -
-

- <%= error_tag f, :email %> -

-
- -
- <%= label f, :password, "New password", class: "label" %> -
- <%= password_input f, :password, class: "input password" %> -
-

- <%= error_tag f, :password %> -

-
- -
- <%= label f, :password_confirmation, "New password confirmation", class: "label" %> -
- <%= password_input f, :password_confirmation, class: "input password" %> -
-

- <%= error_tag f, :password_confirmation %> -

-
- -
- -
-

Enter your current password to make these changes.

-
- -
- <%= label f, :current_password, class: "label" %> - <%= password_input f, :current_password, class: "input password" %> - -

- <%= error_tag f, :current_password %> -

-
- -
-
-
-
-
- <%= submit "Save", phx_disable_with: "Saving...", class: "button is-primary" %> -
-
-
-
- diff --git a/apps/fz_http/lib/fz_http_web/live/account_live/show.html.leex b/apps/fz_http/lib/fz_http_web/live/account_live/show.html.heex similarity index 100% rename from apps/fz_http/lib/fz_http_web/live/account_live/show.html.leex rename to apps/fz_http/lib/fz_http_web/live/account_live/show.html.heex diff --git a/apps/fz_http/lib/fz_http_web/live/account_live/show_live.ex b/apps/fz_http/lib/fz_http_web/live/account_live/show_live.ex index f622b9505..dba6839da 100644 --- a/apps/fz_http/lib/fz_http_web/live/account_live/show_live.ex +++ b/apps/fz_http/lib/fz_http_web/live/account_live/show_live.ex @@ -11,7 +11,7 @@ defmodule FzHttpWeb.AccountLive.Show do {:ok, socket |> assign_defaults(params, session, &load_data/2) - |> assign(:page_heading, "Account")} + |> assign(:page_title, "Account")} end @impl true diff --git a/apps/fz_http/lib/fz_http_web/live/device_live/form_component.html.heex b/apps/fz_http/lib/fz_http_web/live/device_live/form_component.html.heex new file mode 100644 index 000000000..e8d640f51 --- /dev/null +++ b/apps/fz_http/lib/fz_http_web/live/device_live/form_component.html.heex @@ -0,0 +1,25 @@ +
+ <.form let={f} for={@changeset} id="edit-device" phx-target={@myself} phx-submit="save"> +
+ <%= label f, :name, class: "label" %> + +
+ <%= text_input f, :name, class: "input" %> +
+

+ <%= error_tag f, :name %> +

+
+ +
+
+
+
+
+ <%= submit "Save", phx_disable_with: "Saving...", class: "button is-primary" %> +
+
+
+
+ +
diff --git a/apps/fz_http/lib/fz_http_web/live/device_live/form_component.html.leex b/apps/fz_http/lib/fz_http_web/live/device_live/form_component.html.leex deleted file mode 100644 index f3ea7a3a0..000000000 --- a/apps/fz_http/lib/fz_http_web/live/device_live/form_component.html.leex +++ /dev/null @@ -1,23 +0,0 @@ -<%= f = form_for(@changeset, "#", [id: "edit-device", phx_target: @myself, phx_submit: "save"]) %> -
- <%= label f, :name, class: "label" %> - -
- <%= text_input f, :name, class: "input" %> -
-

- <%= error_tag f, :name %> -

-
- -
-
-
-
-
- <%= submit "Save", phx_disable_with: "Saving...", class: "button is-primary" %> -
-
-
-
- diff --git a/apps/fz_http/lib/fz_http_web/live/device_live/index.html.leex b/apps/fz_http/lib/fz_http_web/live/device_live/index.html.heex similarity index 86% rename from apps/fz_http/lib/fz_http_web/live/device_live/index.html.leex rename to apps/fz_http/lib/fz_http_web/live/device_live/index.html.heex index bd52e8c67..b22fa7ca0 100644 --- a/apps/fz_http/lib/fz_http_web/live/device_live/index.html.leex +++ b/apps/fz_http/lib/fz_http_web/live/device_live/index.html.heex @@ -14,7 +14,7 @@ <%= for device <- @devices do %> - <%= live_redirect(device.name, to: Routes.device_show_path(@socket, :show, device)) %> + <%= link(device.name, to: Routes.device_show_path(@socket, :show, device)) %> <%= device.public_key %> <%= device.remote_ip || "Never connected" %> diff --git a/apps/fz_http/lib/fz_http_web/live/device_live/index_live.ex b/apps/fz_http/lib/fz_http_web/live/device_live/index_live.ex index d08037c36..912781952 100644 --- a/apps/fz_http/lib/fz_http_web/live/device_live/index_live.ex +++ b/apps/fz_http/lib/fz_http_web/live/device_live/index_live.ex @@ -10,7 +10,7 @@ defmodule FzHttpWeb.DeviceLive.Index do {:ok, socket |> assign_defaults(params, session, &load_data/2) - |> assign(:page_heading, "Devices")} + |> assign(:page_title, "Devices")} end def handle_event("create_device", _params, socket) do diff --git a/apps/fz_http/lib/fz_http_web/live/device_live/show.html.leex b/apps/fz_http/lib/fz_http_web/live/device_live/show.html.heex similarity index 94% rename from apps/fz_http/lib/fz_http_web/live/device_live/show.html.leex rename to apps/fz_http/lib/fz_http_web/live/device_live/show.html.heex index 4292a9bb3..e3c05e9d7 100644 --- a/apps/fz_http/lib/fz_http_web/live/device_live/show.html.leex +++ b/apps/fz_http/lib/fz_http_web/live/device_live/show.html.heex @@ -63,10 +63,10 @@
- <%= live_redirect("Back to Devices", to: Routes.device_index_path(@socket, :index), class: "button") %> + <%= link("Back to Devices", to: Routes.device_index_path(@socket, :index), class: "button") %> diff --git a/apps/fz_http/lib/fz_http_web/live/device_live/show_live.ex b/apps/fz_http/lib/fz_http_web/live/device_live/show_live.ex index ed495da16..cb1f49140 100644 --- a/apps/fz_http/lib/fz_http_web/live/device_live/show_live.ex +++ b/apps/fz_http/lib/fz_http_web/live/device_live/show_live.ex @@ -50,7 +50,7 @@ defmodule FzHttpWeb.DeviceLive.Show do assign( socket, device: device, - page_heading: device.name, + page_title: device.name, wireguard_endpoint_ip: Application.fetch_env!(:fz_vpn, :wireguard_endpoint_ip), wireguard_port: Application.fetch_env!(:fz_vpn, :wireguard_port) ) diff --git a/apps/fz_http/lib/fz_http_web/live/rule_live/index.html.leex b/apps/fz_http/lib/fz_http_web/live/rule_live/index.html.heex similarity index 100% rename from apps/fz_http/lib/fz_http_web/live/rule_live/index.html.leex rename to apps/fz_http/lib/fz_http_web/live/rule_live/index.html.heex diff --git a/apps/fz_http/lib/fz_http_web/live/rule_live/index_live.ex b/apps/fz_http/lib/fz_http_web/live/rule_live/index_live.ex index 1c4d6ac09..7b7883784 100644 --- a/apps/fz_http/lib/fz_http_web/live/rule_live/index_live.ex +++ b/apps/fz_http/lib/fz_http_web/live/rule_live/index_live.ex @@ -8,6 +8,6 @@ defmodule FzHttpWeb.RuleLive.Index do {:ok, socket |> assign_defaults(params, session) - |> assign(:page_heading, "Rules")} + |> assign(:page_title, "Rules")} end end diff --git a/apps/fz_http/lib/fz_http_web/live/rule_live/rule_list_component.html.heex b/apps/fz_http/lib/fz_http_web/live/rule_live/rule_list_component.html.heex new file mode 100644 index 000000000..bd00032cf --- /dev/null +++ b/apps/fz_http/lib/fz_http_web/live/rule_live/rule_list_component.html.heex @@ -0,0 +1,51 @@ +
+

<%= @title %>

+
+ <.form let={f} for={@changeset} id={"#{@action}-form"} phx-target={@myself} phx-submit="add_rule"> + <%= hidden_input f, :action, value: @action %> +
+
+ <%= text_input f, + :destination, + class: "input", + placeholder: "IPv4/6 CIDR range or address" %> +
+
+ <%= submit "Add", class: "button is-primary" %> +
+
+

+ <%= error_tag f, :destination %> +

+ + + <%= if length(@rule_list) > 0 do %> + + + + + + + + + <%= for rule <- @rule_list do %> + + + + + <% end %> + +
Destination
+
+ <%= rule.destination %> +
+
+ + Delete + +
+ <% end %> +
diff --git a/apps/fz_http/lib/fz_http_web/live/rule_live/rule_list_component.html.leex b/apps/fz_http/lib/fz_http_web/live/rule_live/rule_list_component.html.leex deleted file mode 100644 index 6b271cec4..000000000 --- a/apps/fz_http/lib/fz_http_web/live/rule_live/rule_list_component.html.leex +++ /dev/null @@ -1,57 +0,0 @@ -

<%= @title %>

-
-<%= f = form_for @changeset, "#", [id: "#{@action}-form", phx_target: @myself, phx_submit: :add_rule] %> - <%= hidden_input f, :action, value: @action %> -
-
- <%= text_input f, - :destination, - class: "input", - placeholder: "IPv4/6 CIDR range or address" %> -
-
- <%= submit "Add", class: "button is-primary" %> -
-
-

- <%= error_tag f, :destination %> -

- - <%= if @changeset.action do %> -
-

- <%= aggregated_errors(@changeset) %> -

-
- <% end %> - - -<%= if length(@rule_list) > 0 do %> - - - - - - - - - <%= for rule <- @rule_list do %> - - - - - <% end %> - -
Destination
-
- <%= rule.destination %> -
-
- - Delete - -
-<% end %> diff --git a/apps/fz_http/lib/fz_http_web/live/user_live/new.html.leex b/apps/fz_http/lib/fz_http_web/live/user_live/new.html.leex deleted file mode 100644 index e4db6901e..000000000 --- a/apps/fz_http/lib/fz_http_web/live/user_live/new.html.leex +++ /dev/null @@ -1,54 +0,0 @@ -
-
-
-

Sign Up

-
- - <%= f = form_for @changeset, "#", [id: "create-user", phx_submit: :create_user] %> - <%= if @changeset.action do %> -
-

- <%= aggregated_errors(@changeset) %> -

-
- <% end %> - -
- <%= label(f, :email, class: "label") %> -
- <%= text_input(f, :email, class: "input") %> -
-

- <%= error_tag f, :email %> -

-
- -
- <%= label(f, :password, class: "label") %> -
- <%= password_input(f, :password, class: "input") %> -
-

- <%= error_tag f, :password %> -

-
- -
- <%= label(f, :password_confirmation, class: "label") %> -
- <%= password_input(f, :password_confirmation, class: "input") %> -
-

- <%= error_tag f, :password_confirmation %> -

-
- -
-
- <%= submit "Sign Up", class: "button is-primary" %> -
-
- -
-
-
diff --git a/apps/fz_http/lib/fz_http_web/live/user_live/new_live.ex b/apps/fz_http/lib/fz_http_web/live/user_live/new_live.ex deleted file mode 100644 index 80c0f1970..000000000 --- a/apps/fz_http/lib/fz_http_web/live/user_live/new_live.ex +++ /dev/null @@ -1,28 +0,0 @@ -defmodule FzHttpWeb.UserLive.New do - @moduledoc """ - LiveView for user sign up. - """ - use FzHttpWeb, :live_view - - alias FzHttp.Users - - def mount(_params, _session, socket) do - changeset = Users.new_user() - {:ok, assign(socket, :changeset, changeset)} - end - - def handle_event("create_user", %{"user" => user_params}, socket) do - case Users.create_user(user_params) do - {:ok, user} -> - {:noreply, - socket - |> redirect(to: Routes.session_path(socket, :create, user.sign_in_token))} - - {:error, changeset} -> - {:noreply, - socket - |> put_flash(:error, "Error creating user.") - |> assign(:changeset, changeset)} - end - end -end diff --git a/apps/fz_http/lib/fz_http_web/templates/layout/app.html.eex b/apps/fz_http/lib/fz_http_web/templates/layout/app.html.eex index 4ceea4176..f3e9b5f90 100644 --- a/apps/fz_http/lib/fz_http_web/templates/layout/app.html.eex +++ b/apps/fz_http/lib/fz_http_web/templates/layout/app.html.eex @@ -18,7 +18,6 @@ <% end %>
<% end %> -
<%= @inner_content %>
diff --git a/apps/fz_http/lib/fz_http_web/templates/layout/auth.html.leex b/apps/fz_http/lib/fz_http_web/templates/layout/auth.html.heex similarity index 77% rename from apps/fz_http/lib/fz_http_web/templates/layout/auth.html.leex rename to apps/fz_http/lib/fz_http_web/templates/layout/auth.html.heex index 0b7d3736a..a2301c9c0 100644 --- a/apps/fz_http/lib/fz_http_web/templates/layout/auth.html.leex +++ b/apps/fz_http/lib/fz_http_web/templates/layout/auth.html.heex @@ -6,8 +6,8 @@ <%= csrf_meta_tag() %> <%= live_title_tag assigns[:page_title] || "FireZone" %> - "/> - + + diff --git a/apps/fz_http/lib/fz_http_web/templates/layout/live.html.leex b/apps/fz_http/lib/fz_http_web/templates/layout/live.html.heex similarity index 100% rename from apps/fz_http/lib/fz_http_web/templates/layout/live.html.leex rename to apps/fz_http/lib/fz_http_web/templates/layout/live.html.heex diff --git a/apps/fz_http/lib/fz_http_web/templates/layout/root.html.leex b/apps/fz_http/lib/fz_http_web/templates/layout/root.html.heex similarity index 92% rename from apps/fz_http/lib/fz_http_web/templates/layout/root.html.leex rename to apps/fz_http/lib/fz_http_web/templates/layout/root.html.heex index 3f42c6ed1..b07bec4bb 100644 --- a/apps/fz_http/lib/fz_http_web/templates/layout/root.html.leex +++ b/apps/fz_http/lib/fz_http_web/templates/layout/root.html.heex @@ -5,9 +5,9 @@ <%= csrf_meta_tag() %> - <%= live_title_tag assigns[:page_title] || "FireZone" %> - "/> - + <%= live_title_tag assigns[:page_title], prefix: "FireZone • " %> + + @@ -72,7 +72,7 @@